Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-social-auth redirect after login

After google's login, I want to be redirected to my page. This is what I do

<a id="google-login" href="/login/google/?next=/static/index.html">Google</a>

But still I get redirected to

/accounts/profile

How can I make django socail auth redirect me to the page I need?

This is my django-social-auth configuration:

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.mail.mail_validation',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)

I tried adding at the top:

'myapp.views.redirect_to_such_and_such',

Didnt work.

Again, how can I make django socail auth redirect me to the page I need?

Thanks in advance.

Jenia

like image 454
Jenia Ivanov Avatar asked Oct 29 '25 00:10

Jenia Ivanov


1 Answers

Set this:

SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'url_you_want'
like image 83
Daniel Avatar answered Oct 31 '25 22:10

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!