django-allauth without username, login with facebook doesn't work

275 views
Skip to first unread message

Fellipe Henrique

unread,
May 12, 2015, 2:09:53 PM5/12/15
to Django Users
Hello,

I'm trying to use Django-AllAuth social login...

I have a custom user profile and custom usermanage [1]

But, when I click on html template facebook link, anything happen!  with username, works fine.

Here is my settings [2]

My settings is wrong? any idea why this problem happens?

Thanks,
regards



T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

Fellipe Henrique

unread,
May 12, 2015, 2:13:48 PM5/12/15
to Django Users
Just  to complement the previous mail,  normal user (django user) like super-user create using syncdb, works fine!

I'm using django 1.8.

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

Mario Gudelj

unread,
May 12, 2015, 11:26:21 PM5/12/15
to django...@googlegroups.com
What do you mean by nothing happens? Do you get taken to FB? 

Here's what I have in my setup which may help:

The template link looks like this:

<a class="btn btn-primary" href="{% url 'social:begin' 'facebook' %}">Facebook</a>

Make sure you have the following line in your urls.py:

url('', include('social.apps.django_app.urls', namespace='social'))

settings.py:

SOCIAL_AUTH_USER_FIELDS = ['email']
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
SOCIAL_AUTH_FACEBOOK_KEY = 'your_key'
SOCIAL_AUTH_FACEBOOK_SECRET = 'your_secret'
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
SOCIAL_AUTH_ENABLED_BACKENDS=('facebook', 'google')
SOCIAL_AUTH_PROTECTED_FIELDS = ['email']
SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['first_name', 'last_name', 'email']

AUTHENTICATION_BACKENDS = (
    'social.backends.facebook.FacebookOAuth2',
    'social.backends.google.GoogleOAuth2',
    'social.backends.twitter.TwitterOAuth',
    'django.contrib.auth.backends.ModelBackend',
)

Add 'social.apps.django_app.default', to INSTALLED_APPS

Use https://github.com/omab/python-social-auth and follow installation instructions from it. You'll need to setup your FB app as well.

I think that's all you need.

Good luck man.



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZHCBfJsu8dCHk%3DeoPuTCPC9Jskxk16fbGR_W7DNyC8QRQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Fellipe Henrique

unread,
May 13, 2015, 1:13:38 PM5/13/15
to Django Users
Hi Mario,

I`m not using python-social-auth... I choose to use all-auth[1] because it's given to me more the social login, like: password reset, email validation etc.

My problem is: in template when I click on a button, nothing happen.. the link (javascript) is correct, but nothing happen...



T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

Mario Gudelj

unread,
May 14, 2015, 1:43:29 AM5/14/15
to django...@googlegroups.com
Sorry man. My mistake. 

So are you saying that you have a link with onclick or something? Do you get the JS error? Is it logged inside your browser's console? It's a bit hard to tell without more code or the URL...

Fellipe Henrique

unread,
May 14, 2015, 8:52:07 AM5/14/15
to Django Users
Hello Mario, thanks for help me...

Yesterday I found the problem, here is: First i used python-social-auth.... after I move to django-allauth... for some reason, when I uninstalled the python-social-auth, the folder still in site-package, and when I call my template, django use the python-social-auth javascript!!!

I manually remove the folder, and reinstall django-allauth and work fine now!

Regards,

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

Reply all
Reply to author
Forward
0 new messages