0
votes

I'm trying to to a request to the Google Calendar API using Postman. Following this Google documentation: https://developers.google.com/calendar/v3/reference/?apix=true

I'm doing a:

GET  https://www.googleapis.com/calendar/v3/calendars/{my_calendar_id_here}

On the Postman Authorization tab i'm specifying that i want to use OAuth 2.0 and i also put my access token (which i use to make Calendar API calls from code, works fine). However, Postman responds with the following body:

{
  "error": {
    "code": 401,
    "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
      {
        "message": "Invalid Credentials",
        "domain": "global",
        "reason": "authError",
        "location": "Authorization",
        "locationType": "header"
      }
    ],
    "status": "UNAUTHENTICATED"
  }
} 

I really don't understand what i'm doing wrong, and other answers don't seem to target my particular scenario. I'd be grateful if someone could point out what am i doing wrong.

1

1 Answers

1
votes

I would recommend replicating the request in Google's OAuth 2.0 Playground. Then using the confirmed to be working access token to troubleshoot Postman.

For Postman you could also pass the access token as a request header and if that resolves the issue.

Postman Headers Tab Input:

| Key           | Value                 |
|---------------|-----------------------|
| Authorization | Bearer {access_token} |