People Advanced Service. Permanent authorization required

101 views
Skip to first unread message

IAlex

unread,
Jul 14, 2019, 10:10:22 PM7/14/19
to Google Apps Script Community
The script can't flow throw authorization. There is a permanent request for scopes.

Code.gs

function myFunction() {
 
Logger.log(People.People.get('people/me', {
    personFields
: 'emailAddresses,metadata',
    fields
: 'resourceName,emailAddresses/value,metadata'
 
}));
}

Manifest

{
 
"timeZone": "Europe/Moscow",
 
"dependencies": {
   
"enabledAdvancedServices": [{
     
"userSymbol": "People",
     
"serviceId": "peopleapi",
     
"version": "v1"
   
}]
 
},
 
"oauthScopes": ["profile"],
 
"exceptionLogging": "STACKDRIVER"
}



Dimu Designs

unread,
Jul 15, 2019, 7:17:13 AM7/15/19
to google-apps-sc...@googlegroups.com
The "profile" scope as listed in your manifest (under "oauthScopes") is not associated with the People API (its only used by Google Sign-In and OpenId Connect APIs).

What you need is the following scope:

IAlex

unread,
Jul 19, 2019, 3:57:14 AM7/19/19
to Google Apps Script Community
Unfortunately It doesn't work. Before this I had "userinfo.profile" and then just started to give an error is not enough rights.

I'm going to reset the project and to try again.

IAlex

unread,
Jul 19, 2019, 4:03:10 AM7/19/19
to Google Apps Script Community

Eric Koleda

unread,
Jul 23, 2019, 3:49:57 PM7/23/19
to Google Apps Script Community
The problem here is that the exact string "profile" doesn't match a scope string that the API claims to accept:


Even though "profile" is a synonym for "https://www.googleapis.com/auth/userinfo.profile" the logic in Apps Script is that you need to have at least one of the required scopes to made the call to the advanced service.

- Eric

IAlex

unread,
Jul 25, 2019, 10:18:10 AM7/25/19
to google-apps-sc...@googlegroups.com
I reset authorization via invalidateAuth. And it worked. But at the beginning I lost access without a reason (I didn’t change the code) changed userinfo.profile to profile.

The next scopes are correct

https://www.googleapis.com/auth/userinfo.profile
https
://www.googleapis.com/auth/userinfo.email

Thanks for the support.

Alex

unread,
Aug 8, 2019, 6:16:39 AM8/8/19
to Google Apps Script Community
It seems this is not enough for Google Data Studio CC https://groups.google.com/forum/#!topic/data-studio-developers-forum/xTgRtdax3Dw
Reply all
Reply to author
Forward
0 new messages