문제

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?

올바른 솔루션이 없습니다

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top