Question

I am using this three scopes:

            scopes[0] = "https://www.googleapis.com/auth/drive";
            scopes[1] = "https://www.googleapis.com/auth/userinfo.email";
            scopes[2] = "https://www.googleapis.com/auth/userinfo.profile";

Authorizing them, and then trying to get user's email address according to:
https://developers.google.com/drive/v2/reference/permissions/list
By doing:

            PermissionList permissions = _service.Permissions.List("root").Fetch();
            IList<Permission> a = permissions.Items;

And I don't see the emailAddress.
When I'm including the same scopes (even only the first two) at the "Try it!" section,
I get a result including the emailAddress

What am I missing?

Pas de solution correcte

Autres conseils

If you're looking for the email of the authorizing user, try the tokeninfo endpoint (which you should be calling anyway for security purposes). See https://developers.google.com/accounts/docs/OAuth2Login#obtaininguserprofileinformation

I could be wrong but just by the way you have referenced the scopes e.g. scopes[0], scopes[1], scopes[2]. It looks like you are storing them in an array.

When I was retrieving user info using the client side (javascript) oauth, they were simply space delimited.

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

To add multiple scopes, add a whitespace in between the scopes.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top