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

Closed
opened 2025-12-29 19:45:26 +01:00 by adam · 0 comments
Owner

Originally created by @mdeclara on GitHub (Aug 9, 2022).

Originally assigned to: @arthanson on GitHub.

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>

Originally created by @mdeclara on GitHub (Aug 9, 2022). Originally assigned to: @arthanson on GitHub. ### 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](https://python-social-auth.readthedocs.io/en/latest/use_cases.html#return-the-user-to-the-original-page)). 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>`
adam added the type: bugstatus: accepted labels 2025-12-29 19:45:26 +01:00
adam closed this issue 2025-12-29 19:45:26 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6792