[Solved]-Caller does not have permission error when using GMail API

3👍

Here’s a workaround:

  • Download the discovery_doc directly from google here
  • Load the json file (you can name it gmail-api.json)
  • Build from this json file using build_from_document

Before

    from googleapiclient.discovery import build

    gmail_creds = get_service_account_creds()
    gmail_service = build('gmail', 'v1', credentials=gmail_creds)

After

    from googleapiclient.discovery import build_from_document

    discovery_doc = load_json('config/gmail-api.json')
    gmail_creds = get_service_account_creds()

    gmail_service = build_from_document(discovery_doc, credentials=gmail_creds)

It seems that it is now a P0 for Google, so hopefully it will be fixed soon.

https://issuetracker.google.com/issues/160441983

1👍

I am also started facing this issue. I have been using Google APIs for more than a year, but suddenly this error HttpError 403 when requesting https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest returned "The caller does not have permission. However, couple of times I didn’t see this error and API call was successful. I hope this error at the Gmail API server.

Update:
I am able to call Google APIs without any issues. Seems like issue is resolved at google’s end.

👤Afiz

0👍

I am having the same issue with GAM ADV-X. I thought it was an issue on my computer so I tried on 2 different computers and get the same error. It indeed looks like something changed in the Gmail API over the weekend. Will submit a ticket to Google.

Leave a comment