How to get the Google user ID (email) when using Google Account OAuth API

旧巷老猫 提交于 2019-11-29 10:49:24

We can get google Email address only not the contacts by making the scope of request token Like :

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

Now do a authorized call to get the response like :

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

Here by saying authorized call mean to make the HTTP Get request with required paramaters in header.

header string should contain: realm, consumerKey, signatureMethod, signature, timestamp, nounce, OAuthVersion, token

Please refer to http://googlecodesamples.com/oauth_playground to verify your code and to see the correct header string parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!