How to get the email address of an user that connects with oAuth2

15,965 views
Skip to first unread message

code.w...@gmail.com

unread,
Jul 14, 2017, 5:22:03 AM7/14/17
to AdWords API Forum
Hello,

I was wondering if it is somehow possible to get the email address of an user that conencts to the AdWords API via oAuth2.
When I test the oAuth2 connection, I only get the refresh token which I can use to access the AdWords accounts, but it seems as if I am not able to see the user's email address anywhere.

Do I have to add more permissions to to get the email address?

Thank you
Code-Working

Shwetha Vastrad (AdWords API Team)

unread,
Jul 14, 2017, 10:51:03 AM7/14/17
to AdWords API Forum
Hi,

To retrieve the email address, you need to include the scope: "https://www.googleapis.com/auth/userinfo.email" as mentioned in this document. If this scope is included while you generate the refresh token, you should be able to get the email address of the authenticating user by making the following request: 
https://www.googleapis.com/oauth2/v2/userinfo?access_token="YOUR_ACCESS_TOKEN".

You can try this out in the API explorer.

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages