I'm using DotNetOpenAuth lib to work with Google(only) OpenId. And I'm retrieving Email without any problem. But I can't get FullName, it is always 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;
}
I googled this problem and found that:
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
But it was in Sep 2009, maybe something was changed from that moment... I've found that in http://code.google.com/apis/accounts/docs/OpenID.html:
openid.ax.required -- (required) Specifies the attribute being requested. Valid values include: "country", "email", "firstname",开发者_StackOverflow中文版 "language", "lastname". To request multiple attributes, set this parameter to a comma-delimited list of attributes.
So, my question is how can I get FullName (FirstName, LastName) from Google OpenId?
The Google docs you linked to say Google uses Attribute Exchange, and it looks like ClaimsRequest is a Simple Registration thing. See AXFetchAsSregTransform, or the OpenId.Extensions.AttributeExchange
classes.
精彩评论