I want to let users use their google account to login to my website. Exactly the way SO lets me. Can anyone please point in the right direction? I'm assuming the oAuth library is to be used but what I'd really like is a snippet of code I can directly copy paste and get this to work.
3 Answers
It's not OAuth particularly that you need (OAuth is for authorising access for one website to specific private content held on another), but OpenID - which is meant for authentication rather than authorisation. (Some sites, like Twitter, do provide authentication services via OAuth, but that's not what it's primarily for.) I have used python-openid which is fairly straightforward to use, or you can look at django-openid - though it admits to being incomplete, you could get some idea of how to implement OpenID support.
The problem's a little too involved to admit a copy-and-paste solution, but it's not especially hard to do this.
Update: piquadrat's link (in he comment) is definitely worth following.
- 95,872
- 14
- 179
- 191
-
3I've written a somewhat comprehensive compilation of OpenID auth backends for Django in a question of mine: http://stackoverflow.com/questions/2123369/whats-the-best-solution-for-openid-with-django – Benjamin Wohlwend May 17 '10 at 09:42
-
I ended up using django_authopenid. – Gaurav Sharma May 17 '10 at 14:16
You may want to check out django-piston which is a mini-framework with oAuth built in. Here's a tutorial on how to set it up.
- 18,217
- 15
- 74
- 89
You might consider using Django-Socialauth, as it supports
- Gmail
- Yahoo (essentially openid)
- OpenId
- 47,306
- 11
- 48
- 68