omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Google: Backend not found #862

Closed anderflash closed 8 years ago

anderflash commented 8 years ago

I try to follow the Book "Django By Example" (Chapter 04) with Django 1.9 and Python 3.5.1, but when I try the google login, it doesn't work. I put just 'social.backends.google.GoogleOAuth2',, but the debug says: Backend not found.

What am I doing wrong? Thanks

tisdall commented 8 years ago

Do you have a directory or file in your own project called "social"?

anderflash commented 8 years ago

No, and it works with Facebook, but not with Google

tisdall commented 8 years ago

I don't think you'll get much help on here as the backend does exist and you haven't given much information to go on... You could try python manage.py shell and run from social.backends.google import GoogleOAuth2 and see what it says.

anderflash commented 8 years ago

I've found the problem. There is a mistake in the book. They suggest adding this to the template:

<li class="google"><a href="{% url "social:begin" "google" %}">Login
with Google</a></li>

Change google by google-oauth2:

<li class="google"><a href="{% url "social:begin" "google-oauth2" %}">Login
with Google</a></li>

So the backend for Google (by using OAuth2) is registered as google-oauth2.

Thanks

philliphuangca commented 8 years ago

hey anderflash, i'm going through the same book (Django by Example) and encountered the same Backend not found error. I did what you suggested changing from google to google-oauth2 in the login template, and I also used the 'social.backends.google.GoogleOAuth2' in settings.py, but I'm still getting the error. How did you resolve your issue? Thanks

simple0426 commented 8 years ago

Thanks for @anderflash , i solved this problem according to your suggestion.

ghost commented 8 years ago

@anderflash :+1: Got my OAuth login ironed out thanks friend

diorich commented 7 years ago

Yep i had the same problem thanks for posting.... One thing i have noticed is that if i click edit profile it throws an error does everyone else get this or have i missed something. That is once you have logged in with the social accounts. Its because a profile doesn't exist yet.

vglfr commented 7 years ago

Just for the record: it's 'social_core.backends.google.GoogleOAuth2' now (social-auth-app-django 1.1.0, social-auth-core 1.2.0).

ashishpahwa7 commented 7 years ago

Hope this helps : https://github.com/omab/python-social-auth/blob/master/MIGRATING_TO_SOCIAL.md

liliburg711 commented 6 years ago

Thank you! @anderflash, I also encountered this problem and solved by your suggestion.

rashmitpankhania commented 6 years ago

Umm i m having problem with facebook someone please help me iut

dilvane commented 6 years ago

@rashmitpankhania

FacebookOAuth2
<a href="{% url "social:begin" "facebook" %}">Facebook</a>

FacebookAppOAuth2
<a href="{% url "social:begin" "facebook-app" %}">Facebook</a>