Search code examples
djangofacebook-oauthpython-social-auth

Django facebook login


I had facebook login setup using python-social-auth a while ago, but it stopped working. Now I updated social auth library and set it up again. I went trough a few errors from incorrect secret, incorrect facebook setup up till "Authentication process canceled". Now it seems like whole process went successfully, however once I am redirected back, I am still not logged in.

I think, I have same problem with google auth, which worked alright even before I updated library, so I guess some configuration changed. I upgraded from python-social-auth==0.2.21 to python-social-auth==0.3.6.

I checked newest documentation and changed a few bits, that were different with no help. I got standard pipeline, social AUTHENTICATION_BACKENDS first, updated context processors (prefix social.apps.django_app -> social_django), but still no help.

I already went trough quite a few files of the library and related ones to fix those errors. Now I kinda don't know where should I look for problem and dig a bit.

Any hints would be greatly appreciated!


Solution

  • Okay, it took me a lot of digging. I knew whole pipeline was going trough and there was user instance in the end + request.user.is_authenticated() returned true. However after redirect, I wasn't logged in.

    In the end, I found out, I had to change social.backends.facebook.FacebookOAuth2 to social_core.backends.facebook.FacebookOAuth2 in AUTHENTICATION_BACKENDS (and same for GoogleOAuth2). Very annoying and hard to find.