python-social-auth custom redirect url in Django python-social-auth custom redirect url in Django django django

python-social-auth custom redirect url in Django


I'm pulling your answer out of the question and placing it here for future reference.

Adding a parameter ?next={{request.get_full_path}} to the auth url.


A bit better is to conditianally add next when it exsists

 <a href="{% url 'social:begin' "google-oauth2" %}    {% if request.GET.next %}?next={{request.GET.next}}{% endif %}">      <img src="{{ STATIC_URL }}images/login-google.png" alt="Google"> </a>