I am trying to learn how to integrate python social auth into a django project.
It seems to work, because I can log into my test application, but it seams that the user is never stored to the db and I can't understand why, since I don't get any error.
Here's my conf
INSTALLED_APPS = (
...
'social.apps.django_app.default',
'messaging'
)
AUTHENTICATION_BACKENDS = (
'social.backends.facebook.FacebookOAuth2',
'social.backends.email.EmailAuth',
'django.contrib.auth.backends.ModelBackend',
)
SOCIAL_AUTH_FACEBOOK_KEY='XX'
SOCIAL_AUTH_FACEBOOK_SECRET='YYY'
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/home/'
LOGOUT_REDIRECT_URL = '/'
URL_PATH = ''
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'social.apps.django_app.context_processors.backends',
'social.apps.django_app.context_processors.login_redirect',
)
My idea is just to use django default model for the user, so I haven't defined any extension for it.
Do you have any idea why users are not created at login?
UPDATE
I noticed something that looks weird, at least to me. The first admin user which is created when doing syncdb has the same first and last name of the facebook account I am using to test the application. I thought that it was not going to be used and that another user had to be created, but while checking the database i saw that auth_user.last_login was updated accordingly to the login performed with facebook.
So I have these two questions:
- is it correct that python social auth checks if a user with the same first and last name is already present in auth_user then it uses that particular user instead of creating another one?
- how can I avoid the situation where user Foo Bar on facebook and user Foo Bar on Twitter are not the same person?