redirect Django to custom page after social login and then redirecting to previous page using ?next

Viewed 108

In django,

When user logs in using Login from google, I am redirecting it to /user/profile/picture/ where I am doing some code to store profile picture in another table.

Then I want to redirect the user to previous page where he/she clicked Siginin in with google


What I have tried:

In settings.py

LOGIN_REDIRECT_URL = '/user/profile/picture/'

In home.html

<a href="{% provider_login_url 'google' %}?next={{request.path}}">

The main problem is here. Django redirects to /user/profile/picture/ and it loses the next parameter. And if I remove the line LOGIN_REDIRECT_URL = '/user/profile/picture/, the problem is that it will not create a new row in table for setting profile picture and it will directly redirect to previous page using next paramter.


What I want?

I want django to redirect me first to user/profile/picture and then redirect me to the previous page where user clicked on Sigin with Google

PS: I am using django 3.0.5 if it makes any difference.

0 Answers
Related