views:

380

answers:

1

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", "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?

+4  A: 

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.

keturn
Sreg only has a concept of full name. The doc you found on Google's OP suggests that only individual first and last name attributes are available. The AXFetchAsSregTransform behavior would translate the sreg full name to the AX full name, which Google will ignore. It looks like you'll have to use AX directly as keturn suggested, and request the individual first and last name attributes to get it from Google.
Andrew Arnott
Yep, guys you are right, thanks a lot! Here is the example described how to use AX directly: http://stackoverflow.com/questions/1301200/openid-trying-to-get-email-address-from-google-op, but please remember that now you can ask not just email, but also WellKnownAttributes.Name.First, WellKnownAttributes.Name.Last and so on
Andrew Kramarev