10

Well, I thought this shouldn't be a big problem. However, since I have spent more than one day on this, I think it is the time for asking help.

I have a simple django admin project and it works fine now. The problem is that I want to implement the feature that only allow the user login my admin site with particular google app domain, like @example.com. Then users doesn't have to manually create account and it is easy for me to manage users.

I believe this is a common feature required by many websites. So I do some search and I found some posts introduce some interesting libraries.

The post here are helpful:

Google apps login in django

What's the best solution for OpenID with Django?

Which openid / oauth library to connect a django project to Google Apps Accounts?

The last one the one I think should work for me, but it doesn't.

I have installed the python-openid patch from adieu on github:https://github.com/adieu/python-openid and it still give the same error: 'OpenID authentication failed: HTTP Response status from identity URL host is not 200. Got status 404'

After some diggings, I cannot figure out the solution.

Then I start looking for 'Google Accounts Authentication and Authorization' see if I can build the whole thing by myself.

Now, my question, should I keep sticking on the exist django libraries or should I starts doing something from the beginnings.

So the ideal solution is either some hint for solving the error on python-openid or give the direction for next move (new libraries or Google Accounts Authentication and Authorization)

Thanks in advance!

Community
  • 1
  • 1
Jerry Meng
  • 1,466
  • 3
  • 21
  • 40
  • Did you look at django-social-auth? It has a google auth backend: http://django-social-auth.readthedocs.org/en/latest/backends/google.html – krak3n May 16 '13 at 15:06
  • I will take a look. Appreciate for any help – Jerry Meng May 16 '13 at 15:09
  • Hey Jerry, I am currently looking to ways to do this as well. Did django-social-auth work out well? – skeryl Feb 21 '14 at 02:05
  • @skeryl, I cannot recall everything, but I do remember I built this feature by myself from scratch. The link below is the one guide me for implementation: https://developers.google.com/accounts/docs/OAuth2Login?hl=de-DE; In fact implement such feature is not hard. Good luck – Jerry Meng Feb 21 '14 at 14:48
  • are you using the package registration redux to create the account. If so i have one solution. – Thameem Oct 05 '16 at 06:34

2 Answers2

1

Based on my experience, best thing you can use is python-social-auth. Python social auth generates user with its own structure but you can define pipeline and say that whenever python-social-auth creates new user, you can also create django user.

Brkyrn
  • 387
  • 3
  • 11
0

I made this https://github.com/burke-software/django-auth-gapps based off of a blog post at http://peterkropf.com/archives/13

It could certainly use some improvements. I found this post when searching to see if anyone had a better solution. But it does work according to your workflow.

Bufke
  • 3,195
  • 3
  • 28
  • 28