所以这里有一些关于请求的代码: -
IAuthenticationRequest req = openid.CreateRequest(Request.Form["openid_identifier"]);
//add extention requests here
req.AddExtension(new ClaimsRequest
{
Email = DemandLevel.Request,
BirthDate = DemandLevel.Request,
Country = DemandLevel.Request,
FullName = DemandLevel.Request,
Gender = DemandLevel.Request,
Language = DemandLevel.Request,
Nickname = DemandLevel.Request,
PostalCode = DemandLevel.Request,
TimeZone = DemandLevel.Request
}
);
//get the request from openid
return req.RedirectingResponse.AsActionResult();
以下是拾取器的一些内容: -
//get attributes from site
var sreg = response.GetExtension<ClaimsResponse>();
string sreg_email = "Unknown Email";
DateTime sreg_birthdate;
string sreg_birthdateraw;
Gender sreg_gender;
Version sreg_version;
string sreg_timezone;
string sreg_nickname;
string sreg_postalcode;
System.Globalization.CultureInfo sreg_culture;
string sreg_country;
string sreg_fullname;
System.Net.Mail.MailAddress sreg_mailaddress;
string sreg_language;
if (sreg != null)
{
sreg_email = sreg.Email;
sreg_birthdate = sreg.BirthDate.Value;
sreg_birthdateraw = sreg.BirthDateRaw;
sreg_country = sreg.Country;
sreg_culture = sreg.Culture;
sreg_fullname = sreg.FullName;
sreg_gender = sreg.Gender.Value;
sreg_language = sreg.Language;
sreg_mailaddress = sreg.MailAddress;
sreg_nickname = sreg.Nickname;
sreg_postalcode = sreg.PostalCode;
sreg_timezone = sreg.TimeZone;
sreg_version = sreg.Version;
}
但无论我使用哪个OpenId提供程序,它都会返回null ...
我错过了一些明显的东西吗?
罗布
答案 0 :(得分:0)
你打开了AXFetchAsSregTransform吗?此外,某些提供商不会向您提供任何信息,除非您的网站上有RP discovery works和/或您在ClaimsRequest
中发布了隐私政策,我在您的代码中没有这样做。
某些提供商只是不提供数据。但MyOpenID.com是一个应该为您现有的网站和代码工作的提供商(因为它没有我上次检查时列出的额外限制)。您是否针对MyOpenID.com进行了测试?