我正在使用 DotNetOpenAuth 使用 Google OpenId 登录我的网站。简单的代码,之前讨论过很多次:
protected static readonly string ENDPOINT = "https://www.google.com/accounts/o8/id";
public void RequestAuthentication(string realm, Uri returnUrl) {
using (OpenIdRelyingParty openid = new OpenIdRelyingParty()) {
IAuthenticationRequest openRequest = openid.CreateRequest(ENDPOINT, realm, returnUrl);
var fr = new FetchRequest();
fr.Attributes.Add(new AttributeRequest(WellKnownAttributes.Contact.Email, true));
fr.Attributes.Add(new AttributeRequest(WellKnownAttributes.Preferences.TimeZone, false));
fr.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.FullName, true));
fr.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.Alias, false));
fr.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.Last, true));
fr.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.First, true));
openRequest.AddExtension(fr);
openRequest.RedirectToProvider();
}
}
这可行,但每次谷歌要求确认将用户的电子邮件传递到我的网站时,忽略“记住我的决定”复选框!
我已经尝试将 FetchRequest 替换为 ClaimsRequest(使用 AXFetchAsSregTransform)——没有区别。
我做错了什么?