问题
I'm doing a get request to the following URL (with {id} replaced with the id from the web interface):
https://www.googleapis.com/calendar/v3/calendars/{id}
A few assertions:
The Authorize header is being correctly set with a valid access token (the token works fine for the Analytics API)
I've set the following scope for oauth2, which shows up correctly:
https://www.googleapis.com/auth/calendar
The token doesn't appear to have expired; it works for the Analytics API.
{ "error": { "errors": [ { "domain": "global", "reason": "insufficientPermissions", "message": "Insufficient Permission" } ], "code": 403, "message": "Insufficient Permission" } }
回答1:
To fix, I revoked access to the app at https://accounts.google.com/IssuedAuthSubTokens and retried after which, I was able to access the API correctly.
Despite having the scope in the list, and the scope showing up on Google's OAuth2 grant page, the additional scope wasn't granted.
回答2:
I would double-check the scope is included - I've seen that exact message when I've requested the wrong scope. Visiting https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=xxxxxx is a good way to verify.
Assuming that checks out, make sure that the user that you have the access token for has permission to view the calendar that you're trying to access. "Gears" icon -> "Settings" -> "Calendars" -> (select calendar) -> "Share this calendar"
回答3:
Add scope for calendar visit calendar api and check access configuration
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.readonly
回答4:
I had to include the Google Plus scope in order to have sufficent permission to access a calendar:
So my scope
ended up looking like this:
'https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly', 'https://www.googleapis.com/auth/plus.login'
回答5:
I have had to delete permissions to my application and then back to give permissions in https://security.google.com/settings/security/permissions
回答6:
I had the same issue while I was trying to add an event in my google calendar. How I finally fixed this :
- delete my file 'credentials.json'
- launch a Python program which looks like the Google's quickstart program with written in " SCOPES = 'https://www.googleapis.com/auth/calendar' ". This program was the only solution that worked for me. Launch my django command to call my real work did not work for me. But this fixed my permission problem.
Then, it opens your browser and google asks your permission to manage your calendar and create a new 'credentials.json' in your repertory.
回答7:
I also face same issue when add or edit event. And after some googling, I found that, one scope will give you all permission -
https://www.googleapis.com/auth/calendar
来源:https://stackoverflow.com/questions/16970917/why-is-google-calendar-api-oauth2-responding-with-insufficient-permission