Search code examples
postmangoogle-calendar-api

Auth to google API with API-Key instead of OAuth 2.0


In https://developers.google.com/calendar/api/v3/reference/calendarList/list?apix=true#auth

I can see that I can use OAuth2 and API key to authenticate for the calendarList endpoints:

enter image description here

My first test with postman and OAuth2 works perfect: I get the JSON List of all calendars of the authenticated user

Now I test the endpoint with authentication over API key.

I create the API key and enabled the calendar for this API key:

enter image description here

Problem:

I've tested it with postman and Auth-Type=ApiKey and with parameter key=MYAPIKEY, but I always get error

401 "Request is missing required authentication credential"

enter image description here

Does anyone have a (postman) example to access the Google calendard API with an API key?


Solution

  • API keys are only used to access public data not private user data.

    In order to use an api key with postman you would simply take the rquest and add key=YourKEY on the end

    The following is a good example of this but unfortunately there is currently an issue with API keys and public calendars. Requiring authorization instead of just an api key194427607

    https://www.googleapis.com/calendar/v3/calendars/en.danish%23holiday%40group.v.calendar.google.com?key=[YOUR_API_KEY]
    

    You are not going to be able to use calendar list without being authorized calendarlist.list states in the documentation that you must be authorized as its private user data.

    enter image description here