gpt4 book ai didi

openid - 从 Google 检索 OpenId FullName

转载 作者:行者123 更新时间:2023-12-01 11:38:38 26 4
gpt4 key购买 nike

我正在使用 DotNetOpenAuth 库来处理 Google(仅)OpenId。我正在毫无问题地检索电子邮件。但我无法获取 FullName,它始终为 null。

request.AddExtension(new ClaimsRequest
{
Email = DemandLevel.Require,
FullName = DemandLevel.Require
});

ClaimsResponse claimsResponse = relyingPartyResponse.GetExtension<ClaimsResponse>();

if (claimsResponse != null)
{
var email = claimsResponse.Email;
var fullName = claimsResponse.FullName;
}

我用谷歌搜索了这个问题,发现:

Glad you got it working. Google will not give a full name or nickname for their users. They ONLY give email address, and (I think, but perhaps only on a white list) the timezone. It's not a matter of figuring out how to rig your RP so that it works. Google just won't do it yet. – Andrew Arnott Sep 8 at 14:22 stackoverflow.com/questions/1387438/retrieve-openid-user-information-claims-across-providers

但那是在 2009 年 9 月,也许从那一刻起发生了一些变化...我在 http://code.google.com/apis/accounts/docs/OpenID.html 中发现了这一点:

openid.ax.required -- (required) Specifies the attribute being requested. Valid values include: "country", "email", "firstname", "language", "lastname". To request multiple attributes, set this parameter to a comma-delimited list of attributes.

那么,我的问题是如何从 Google OpenId 获取全名(名字、姓氏)?

最佳答案

你链接到的谷歌文档说谷歌使用属性交换,看起来 ClaimsRequest 是一个简单的注册。参见 AXFetchAsSregTransform ,或 OpenId.Extensions.AttributeExchange 类。

关于openid - 从 Google 检索 OpenId FullName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2454036/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com