12
votes

It appears as though the current version of the Google Calendar API is v3, which in the past I believe has supported both OAuth and simple API Keys for a JavaScript/Browser implementation.

As of 2/2/17: is it possible to still use the Google Calendar API with an API Key, or is required that any access (even access to a public calendar) to the API go through OAuth2.0?

According to the Google Calendar API, "Your application must use OAuth 2.0 to authorize requests" (https://developers.google.com/google-apps/calendar/auth), but my API request is opening a public calendar and does not require a sign-in as none of the data is private.

1
So what was your approach around this issue? - Carlos Martinez

1 Answers

16
votes

Well, it seems that the Google Calendar now needs an authorized tokens to access its own API. It is stated in their documentation that every request your application sends to the Google Calendar API must include an authorization token. The token also identifies your application to Google.

I found here in this question that you cannot access your calendar information using API Key. API keys (or simple API access key) are not authorized tokens and can only be used for some API calls such as a Google search query etc; API keys will not let you access any user specific data, which I am assuming is your objective through this calendar application.

I tried to access a Google calendar request by using an API key, but I get an error 401 "Login Required"

https://www.googleapis.com/calendar/v3/users/me/calendarList/primary?key=YOUR_API_KEY

To verify that the API_KEY is the problem, I try to use it in a Google Maps request.

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap

And I got here a successful response.

I hope this information helps you.