我正在尝试使用 DNOA 为我的应用程序提供 OpenId 支持,以便保留我迄今为止一直使用的 Janrain 解决方案。问题是,到目前为止,我拥有的用户拥有基于个人资料的标识符(https://www.google.com/profiles/11223344556677...),而 DNOA 检索到的标识符的形式为 https://www.google.com/accounts/o8/id?id=xxxxxyyyyyafgsdgfsdhg .
如何检索个人资料信息?通过属性交换?以及哪个属性?或者还有其他的API吗?我看到登录页面有一个 google 提供程序和一个不同的 google profile 提供程序,所以这里有人有答案...:)
更新:Google 个人资料的端点为 (https://www.google.com/profiles/)
所以...现在的问题是如何获取 Google 个人资料 ID 号
最佳答案
Google 个人资料 ID 号是通过“http://schemas.openid.net/ax/api/user_id”属性检索的。将其设置为必需的
在《DNOA》中,
var fetch = new FetchRequest();
fetch.Attributes.AddRequired("http://axschema.org/contact/country/home");
fetch.Attributes.AddRequired("http://axschema.org/contact/email");
fetch.Attributes.AddRequired("http://axschema.org/namePerson/first");
fetch.Attributes.AddRequired("http://axschema.org/namePerson/last");
fetch.Attributes.AddRequired("http://axschema.org/pref/language");
fetch.Attributes.AddRequired("http://schemas.openid.net/ax/api/user_id");
有趣的是,如果我省略其中一些属性,我就无法获取 api/user_id。 无法弄清楚那部分,但我现在并不关心。
关于dotnetopenauth - 如何使用 DotNetOpenAuth 检索 google 个人资料?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4365572/