netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Remote/Social Auth login doesn't follow the "next" URL parameter after logging in

Open mdeclara opened this issue 3 years ago • 0 comments

NetBox version

v3.2.7

Python version

3.9

Steps to Reproduce

  1. 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
  2. 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>

mdeclara avatar Aug 09 '22 20:08 mdeclara