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.
views:
101answers:
4You 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.
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.
This is what I was looking for:
http://www.linuxuser.at/how-i-finally-got-openid-and-django-working-together
Thanks.
You might consider using Django-Socialauth, as it supports
- Gmail
- Yahoo (essentially openid)
- OpenId