Extracting Gmail username with OAuth access token

2019-05-14 07:17发布

问题:

I'm using OAuth to get a user to grant me access to their Gmail IMAP account. I can successfully get an access token, and need to know what endpoint I can access to get the authenticated user's e-mail address.

回答1:

And you can test this feed using Google's OAuth Playground, as I just did.

In step one, paste the scope:

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

And in step six, paste the feed URI:

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

This should help in adapting the feed for use in your own application.



回答2:

You can get user's username and email with endpoint: https://www.googleapis.com/userinfo/email with scope: https://www.googleapis.com/auth/userinfo#email.



标签: oauth gmail imap