4

On November 17, 2014 Google deprecated v1 and v2 of its Google Calendar API using the Zend Framework.

It seems the only way to list publicly shared events on a publicly shared Google Calendar is through the new Google Client Library API from GitHub using OAuth 2.0

This means visitors to a public website that used to display public events now have to authenticate and login.

Is that true? Is there no other way to continue to show public Google Calendar events?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
H. Ferrence
  • 7,906
  • 31
  • 98
  • 161
  • I really need to know how you got this working. Is there any code you can show? I've read multiple answers saying that there is NO api available in IOS that can use a "Service Account". If that's not true, how did you do it. Could you please post some code showing the authentication and query process? Thanks! – JustLearningAgain Jan 03 '16 at 03:30

2 Answers2

9

What you need to do is use a Service account for this. You will then be able add the service accounts email address as a user to the calendar for your website. The Service account will then be able to access this calendar including the events

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Ok, thanks @DaImTo ... even if the calendars are set to public access? Correct? – H. Ferrence Nov 25 '14 at 19:50
  • Can you share any "getting started" PHP code @DaImTo? – H. Ferrence Nov 25 '14 at 20:00
  • 1
    Only thing i have on hand for php Google Analytics With a service account. http://www.daimto.com/google_service_account_php/ Even if it is set to public it shouldn't matter just add the service account email as a user and it will then be able to access it. Its the easiest way to do it, I have done it in .net. I havent had time to make a tutorial for PHP yet. – Linda Lawton - DaImTo Nov 25 '14 at 20:12
  • 1
    When I try to connect via service account client id or email address I get a fatal error shown at http://stackoverflow.com/questions/27135577/how-to-connect-to-a-google-public-calendar @DaImTo – H. Ferrence Nov 25 '14 at 20:24
  • I really need to know how you got this working. Is there any code you can show? I've read multiple answers saying that there is NO api available in IOS that can use a "Service Account". If that's not true, how did you do it. Could you please post some code showing the authentication and query process? Thanks! – JustLearningAgain Jan 03 '16 at 03:09
  • The question is related to php so any code I would post would also be php. I think you should ask a question of your own as to weather or not ios supports service account authentication – Linda Lawton - DaImTo Jan 03 '16 at 08:55
5

You can still retrieve all public data without Oauth2, you just need to register in a developer console and create an API key. Then you can do:

GET https://www.googleapis.com/calendar/v3/calendars/<CALENDAR_EMAIL>/events?key={YOUR_API_KEY}

luc
  • 3,642
  • 1
  • 18
  • 21
  • Thanks @luc. Here is the error message when I use `YOUR_API_KEY`: Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling GET https://www.googleapis.com/calendar/v3/calendars/google%40example.com/events?key=MY-PUBLIC-ACCESS-KEY: (403) Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.' in /usr/local/lib/php/google-api-php-client/src/Google/Http/REST.php:76 – H. Ferrence Nov 25 '14 at 03:24
  • Stack trace: #0 /usr/local/lib/php/google-api-php-client/src/Google/Http/REST.php(41): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request)) #1 /usr/local/lib/php/google-api-php-client/src/Google/Client.php(548): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) #2 /usr/local/lib/php/google-api-php-client/src/Google/Service/Resource.php(190): Google_Client->execute(Object(Google_Http_Request)) #3 /usr/local/lib/php/google-api-php-clien in /usr/local/lib/php/google-api-php-client/src/Google/Http/REST.php on line 76 – H. Ferrence Nov 25 '14 at 03:24
  • This might be obvious, but Calendar API needs to be enabled in the Developer Console. If it is, are you using referrers? If you are, try with no referrers. Leaving that field blank will allow access to anyone. – Andy Nov 25 '14 at 17:58
  • Thanks @Andy. Yes Calendar API was turned on at outset of this effort (last Friday). There are no referrers present – H. Ferrence Nov 25 '14 at 19:49
  • @H.Ferrence were you able to get this working with non-authenticated users? – Sujay Phadke Apr 21 '16 at 21:48