How to get Google user ID (email address) when using Google OAuth account API

I am new to OAuth and want to get a user id (email address) from Google using OAuth.

But I do not want to receive information about contacts with Google users.

+6
source share
1 answer

We can only get a Google email address outside of contacts by setting the Like request marker area:

"https://www.google.com/accounts/OAuthGetRequestToken?scope=https://www.googleapis.com/auth/userinfo#email"; 

Now make an authorized call to get a response like:

 var responseText = oAuthConsumer.GetUserInfo("https://www.googleapis.com/userinfo/email", consumerKey, consumerSecret, token, tokenSecret); 

Here, speaking an authorized call, you need to make an HTTP Get request with the required parameters in the header.

The title bar should contain: realm, consumerKey, signatureMethod, signature, timestamp, nounce, OAuthVersion, token

Please refer to http://googlecodesamples.com/oauth_playground to check your code and see the correct title bar options

+7
source

All Articles