I would like python-social-auth to redirect to /?ref=twitter if user logs in through twitter, and /?ref=google if they login through google-oauth2.
I installed the django version of the python-social-auth library using
pip install social-auth-app-django
So far, the authentication works, but python-social-auth always redirects to / (which is 'home').
Here are my settings:
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'
LOGIN_REDIRECT_URL = 'home'
# Used to redirect the user once the auth process ended successfully. The value of ?next=/foo is used if it was present
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_TWITTER_LOGIN_REDIRECT_URL = '/?ref=twitter'
SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_REDIRECT_URL = '/?ref=google'
# URL where the user will be redirected in case of an error
SOCIAL_AUTH_LOGIN_ERROR_URL = '/?err=true'
SOCIAL_AUTH_TWITTER_LOGIN_ERROR_URL = '/?ref=twitter&err=true'
SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_ERROR_URL = '/?ref=google&err=true'
# Is used as a fallback for LOGIN_ERROR_URL
SOCIAL_AUTH_LOGIN_URL = '/'
SOCIAL_AUTH_TWITTER_LOGIN_URL = '/?ref=twitter'
SOCIAL_AUTH_GOOGLE_OAUTH2_LOGIN_URL = '/?ref=google'
# Used to redirect new registered users, will be used in place of SOCIAL_AUTH_LOGIN_REDIRECT_URL if defined.
# Note that ?next=/foo is appended if present, if you want new users to go to next, you'll need to do it yourself.
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/?user=new'
SOCIAL_AUTH_TWITTER_NEW_USER_REDIRECT_URL = '/?ref=twitter&user=new'
SOCIAL_AUTH_GOOGLE_OAUTH2_NEW_USER_REDIRECT_URL = '/?ref=google&user=new'
# Like SOCIAL_AUTH_NEW_USER_REDIRECT_URL but for new associated accounts (user is already logged in).
# Used in place of SOCIAL_AUTH_LOGIN_REDIRECT_URL
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/?assoc=true'
SOCIAL_AUTH_TWITTER_NEW_ASSOCIATION_REDIRECT_URL = '/?ref=twitter&assoc=true'
SOCIAL_AUTH_GOOGLE_OAUTH2_NEW_ASSOCIATION_REDIRECT_URL = '/?ref=google&assoc=true'
It would be extremely helpful if someone could point out what I am doing wrong here.
I am currently going through their documentation for clues.
Thanks