I'd like to access the name associated with a users google account to resolve a
GoogleJsonResponseException: API call to people.people.get failed with error: The caller does not have permission to request "people/me". Request requires one of the following scopes: [profile]
error.
To do that, I'm attempting to include the https://www.googleapis.com/auth/userinfo.profile scope as listed on Google's list of OAuth 2.0 scopes. However, after editing the appsscript.json to manually include the scope, as outlined here, and attempting to save, it does not work. It displays the "Saving project..." popup, but it never resolves and reloading the page resets appsscript.json without my changes. The scope https://www.googleapis.com/auth/userinfo has the same response. There is no error message associated with this.
Here is my current file- have I missed something silly? Am I going about it wrong?
{
"oauthScopes": "https://www.googleapis.com/auth/userinfo.names",
"timeZone": "America/New_York",
"dependencies": {
"enabledAdvancedServices": [
{
"userSymbol": "People",
"version": "v1",
"serviceId": "peopleapi"
}
]
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"webapp": {
"executeAs": "USER_DEPLOYING",
"access": "MYSELF"
}
}
CodePudding user response:
The oauthScopes
should contain an Array or strings. Considering this, change
"oauthScopes": "https://www.googleapis.com/auth/userinfo.names",
by
"oauthScopes": [ "https://www.googleapis.com/auth/userinfo.names" ],