我对OAuth Arena和Google ApI非常陌生,但我想在此实现的目标非常简单。访问令牌后访问Google API获取个人资料
用户点击谷歌连接按钮和我的web服务应该能够让所有的用户资料信息从谷歌服务器:
我已经写代码来获得的accessToken(我还没有测试它),但是假设工作正常,现在我应该如何让Google API给我用户配置文件?我在GoogleConsumer类中看到名为Get Contacts的静态函数,但我没有看到获取profiledata的任何选项。可能有我缺少的东西?
这里使用我的代码,我得到的accessToken:
IConsumerTokenManager tokenManager =
new LocalTokenManager(consumerKey,consumerSecret);
var googleConsumer =
new WebConsumer(GoogleConsumer.ServiceDescription, tokenManager);
var tokenResult = googleConsumer.ProcessUserAuthorization();
return tokenResult.AccessToken;
现在,我如何得到用户的个人资料出来的吗?
大家好,我不知道为什么enyone还没有触及这个问题。如果我缺乏任何信息,请告诉我。基本上,我惊奇地发现,所有这些WebConsumer(GoogleConsumer和TwitterConsumer)都具有getContacts,UpdateStatus和PostBlog等所有复杂功能,但没有像GetProfile这样的基本功能。我在网上看到的所有示例实际上都会得到USerprofile gy在Google的webservice URL上调用GET,但我没有看到任何演示如何使用GoogleWebConsume检索userProfile的内容。是不可能的? – TeaLeave 2012-04-17 19:43:21
不[此SO帖子](http://stackoverflow.com/questions/7130648/get-user-info-via-google-api)回答你的问题? – shrisha 2012-04-18 00:01:27
嗯,这篇文章说我们可以使用https://www.googleapis.com/auth/userinfo.profile作为范围。这个范围恰好适用于哪里?我是否在RequestAuthorization Call上使用它?因为我试图把这个URL放在上面,但它不需要字符串参数。 – TeaLeave 2012-04-18 01:28:11