Google 上的 OpenID 未返回任何内容
由于某种原因,以下代码不会返回任何内容:
string alias = response.FriendlyIdentifierForDisplay;
var sreg = response.GetExtension<ClaimsResponse>();
if (sreg != null && sreg.MailAddress != null)
{
alias = sreg.MailAddress.User;
}
if (sreg != null && !string.IsNullOrEmpty(sreg.Email))
{
alias = sreg.Email;
}
if (sreg != null && !string.IsNullOrEmpty(sreg.FullName))
{
alias = sreg.FullName;
}
我希望能够从 Yahoo 或 Google 获取电子邮件,但 sreg 只是返回 null,无论我选择哪个提供商。
我看到其他一些帖子说这段代码至少应该返回一封电子邮件,但对我来说,它没有,请帮忙。
多谢
For some reason, the following code does not return anything:
string alias = response.FriendlyIdentifierForDisplay;
var sreg = response.GetExtension<ClaimsResponse>();
if (sreg != null && sreg.MailAddress != null)
{
alias = sreg.MailAddress.User;
}
if (sreg != null && !string.IsNullOrEmpty(sreg.Email))
{
alias = sreg.Email;
}
if (sreg != null && !string.IsNullOrEmpty(sreg.FullName))
{
alias = sreg.FullName;
}
I was hoping I can get the Email from Yahoo or Google, but sreg just return null whichever provider I have chosen.
I saw some of other posts that this code should return an e-mail at least, but for me, it does not, please assist.
Thanks alot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须确保将电子邮件地址添加到 ClaimsRequest 时,required 标志设置为 true。
您还必须确保您已正确激活 AXFetchAsSregTransform。
You must ensure that what you add the email address to ClaimsRequest with the required flag set to true.
You must also ensure that you've correctly activated the AXFetchAsSregTransform.