How do i get the username and email when someone l

2019-06-14 16:06发布

问题:

i used pinax, the user who login my site, use openid, is successful now. i only want to get the username and email when they return .

the google openid url is :https://www.google.com/accounts/o8/id

and yahoo openid url is :http://yahoo.com/

How can i get it?

回答1:

Use http://code.google.com/p/django-openid/ (documentation available at http://django-openid.googlecode.com/svn/trunk/openid.html)



回答2:

There are two main methods to do this. One is using the "simple registration" (sreg) extension of OpenID. This seems like the easiest way, and while it worked when using myopenid.net as my endpoint, but I couldn't get it to work with Google.

The second method is by using the "attribute exchange" (ax) extension. I was able to get it working using Authkit under Pylons with a bit of tweaking. I'm sure you can do the same with Django. I would recommend that you start with the Google docs regarding their AX support: http://code.google.com/apis/accounts/docs/OpenID.html



回答3:

@jamieb - maybe you meant myopenid.com?

Even if late, I wish to share my experience on the question to help others. I spent a day on these!

I used https://github.com/flashingpumpkin/django-socialregistration and only experimented with Simple Registration on the following sites:

  • Google - No information returned or perhaps I need to dig deeper
  • Yahoo - No information returned or perhaps I need to dig deeper
  • myOpenID - Yes! You need to add Registration Personas to which your user will select during the login/registration process. And for each Persona, you can specify picture, full name, nickname, email, birthday, gender, web/url, postal code, country, language.

So to answer the question, if you use Simple registration, you can't get the email or username of the user from Google or Yahoo.