dotnetopenauth - 如何使用 DotNetOpenAuth 检索 google 个人资料?

标签 dotnetopenauth google-openid

我正在尝试使用 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/

相关文章:

openid - 由于编码句柄的反序列化失败而拒绝关联。 DotNetOpenAuth

wcf - DotNetOpenAuth 和 ResourceServer 服务 https 配置

openid - 不使用任何 Google API 进行身份验证的 Google OpenID Connect

asp.net-mvc-4 - 如何将 MVC 4 OpenId Google 登录迁移到 OAuth 2.0 或 Google+ 登录

ruby-on-rails - 当我尝试使用 omniauth-google-oauth2 gem 进行身份验证时,没有路由匹配 [GET] "/auth/google_apps"

c# - 将 OAuth 与 OData 结合使用

c# - 需要 DotNetOpenAuth 教程

c# - 同时支持 asp.net 和 JavaScript 的 OpenID API?

google-app-engine - 使用 Google+ API 登录后获取电子邮件 ID/用户名

python - 使用 google 实现 SSO + OAuth