0

I am trying to delete the emails from Gmail inbox using Gmail API. During this process i am getting below error.

As per the below error understand that i dont have right privileges to delete emails.

Please advise me on how to grant access in Google Cloud APP to allow Delete function.

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden DELETE https://www.googleapis.com/gmail/v1/users/me/messages/188720e09bf038ef { "code" : 403, "details" : [ { "@type" : "type.googleapis.com/google.rpc.ErrorInfo", "reason" : "ACCESS_TOKEN_SCOPE_INSUFFICIENT" } ], "errors" : [ { "domain" : "global", "message" : "Insufficient Permission", "reason" : "insufficientPermissions" } ], "message" : "Request had insufficient authentication scopes.", "status" : "PERMISSION_DENIED" }

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449

1 Answers1

0

ACCESS_TOKEN_SCOPE_INSUFFICIENT

Means exactly that the user who has authenticated your application has not givin your application enough permissions to excuse that method.

The messages.delete method

requires that the user have authenticated for https://mail.google.com/ scope. Wild guess that you have used the quickstart and have only requested read only scope. Fix your code to request the proper scope and request authorization of the user again.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449