2

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?

user990635
  • 3,979
  • 13
  • 45
  • 66

3 Answers3

0

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

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
0

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.

dev
  • 3,969
  • 3
  • 24
  • 36
0
"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.

Freddy
  • 75
  • 1
  • 8