3

I'm getting forbidden 403 error when hitting Gmail API get message through postman please help me how to solve this. error

https://www.googleapis.com/gmail/v1/users/userId/messages this url for getting message list

https://www.googleapis.com/gmail/v1/users/userId/messages/id this is for getting message for particular id

I can able to hit the get message list API but get Message API not working for me

I'M doing all these stuff through postman

error message :

{
"error": {
    "errors": [
        {
            "domain": "global",
            "reason": "forbidden",
            "message": "Metadata scope doesn't allow format FULL"
        }
    ],
    "code": 403,
    "message": "Metadata scope doesn't allow format FULL"
}

}

prahan
  • 44
  • 1
  • 3

1 Answers1

4

This is another disappointing design in the Gmail API. I resolved this issue with the following steps:

  1. Remove GmailScopes.GMAIL_METADATA from scopes setup.
  2. Remove the credential file from your local FileSystem. This file is generated by Google's Authorization Flow which store your credential locally.
  3. Re authorize your app by signing in again https://accounts.google.com/o/oauth2/auth?access_type=offline....

Hope this helps you guys out.

Nick E
  • 51
  • 2
  • I had the same issue in Google Workspace, where I currently develop a gmail addon for our company. Here the deployment descriptor contained both `https://www.googleapis.com/auth/gmail.metadata` and `https://www.googleapis.com/auth/gmail.readonly` and the presence of the former scope resulted in requests that try to set `gmail.users().messages().get("me", messageId).setFormat("full")...` to fail with the above-mentioned failure. After removing the metadata scope the add-on can now read emails – Roman Vottner Aug 07 '23 at 11:18