开发者

How do i get the username and email when someone logins to my site using google or openid? What does google return?

开发者 https://www.devze.com 2022-12-20 08:27 出处:网络
i used pinax, the user who login my site, use openid,is successful n开发者_如何学Goow. i only want toget the username and emailwhen they return .

i used pinax, the user who login my site, use openid, is successful n开发者_如何学Goow. 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?


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


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


@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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号