netbox
netbox copied to clipboard
Remote/Social Auth login doesn't follow the "next" URL parameter after logging in
NetBox version
v3.2.7
Python version
3.9
Steps to Reproduce
- Hit the /login page with a remote/social auth backend configured (e.g. 'social_core.backends.azuread.AzureADOAuth2') and a "next=/some/valid/path" post-login redirect in the URL that isn't the home page
- Log in with social auth provider
Expected Behavior
The browser should be redirected to the location specified in the "next" parameter after successful login.
Observed Behavior
The browser is always redirected to the home page.
The python-social-auth docs have a section on how to achieve this (here). I was able to get the expected redirect working by modifying the login.html template page to include "?next={{ request.GET.next }}" in the social auth login url.
<a href="{% url 'social:begin' backend=name %}?next={{ request.GET.next }}" class="my-2">{{ display.0 }}</a>