pythonopenidpython-openid

Yahoo! OpenID doesn't include Attribute Exchange info (using python-openid)


I'm using python-openid to successfully connect my python based site with OpenID. It works great with Google and it works with Yahoo! but with Yahoo! the Attribute Exchange doesn't seem to work. I only ever get the email address. firstname, lastname and country is always blank. I know the Yahoo! account (by that email address) has a firstname and lastname defined.

I use these parameters amongst the normal OpenID ones:

    'openid.ns.ax':'http://openid.net/srv/ax/1.0',
    'openid.ax.mode':'fetch_request',
    'openid.ax.required':'firstname,lastname,email,country',
    'openid.ax.type.firstname':'http://axschema.org/namePerson/first',
    'openid.ax.type.lastname':'http://axschema.org/namePerson/last',
    'openid.ax.type.email':'http://axschema.org/contact/email',
    'openid.ax.type.country':'http://axschema.org/contact/country/home',

Searching I found this answer but I'm not familiar with the PHP framework and its use of "counts". There is no such thing in the python-openid framework.


Solution

  • Better late than never, perhaps. I was just testing this same thing in Perl, using the Net::OpenID::Consumer package, and had similar issues. I first discovered that firstname and lastname are not available from yahoo, instead you must define another type pointing to the axschema type http://axschema.org/namePerson, and you can also request their media image, but first name and last name will never work.

    The documentation for yahoo's openid attribute exchange stuff is here (and it's terrible, IMHO, but at the same time, it is up to the developer to know how to define types and point them to the right schema values): http://developer.yahoo.com/blogs/ydn/posts/2009/12/yahoo_openid_now_with_attribute_exchange/.

    This, as opposed to google, where the values that you can request are country, email, firstname, lastname and langauge, documented better here: http://code.google.com/apis/accounts/docs/OpenID.html

    Given the differences, it might be prudent to offer different return urls for each provider listed. I have not listed the attributes for MyOpenID, because I haven't tested it as of yet.