Search code examples
djangopython-social-auth

python social auth, log in without logging out


With python social auth, when a user is logged in when he clicks 'Login with Facebook' or similar.

The request.user is not the newly logged in facebook user but the old logged in user.

  • log in with email test1@gmail.com
  • log in with facebook email test-facebook@gmail.com

Logged in user (request.user) is still test1@gmail.com

Is this intended behavior? Is there a way to fix this or should I not present log-in unless he's not logged out?


Solution

  • If there's a user already logged in in your app, then python-social-auth will associate the social account with that user, if it should be another user, then the first must be logged out. Basically python-social-auth will create new users if there's none logged in at the moment, otherwise it will associate the the social account.