mozilla / mozilla-django-oidc

A django OpenID Connect library
https://mozilla-django-oidc.readthedocs.io
Mozilla Public License 2.0
444 stars 166 forks source link

Do not set oidc_login_next for AJAX 403 redirects #500

Open drwonky opened 1 year ago

drwonky commented 1 year ago

Moved the oidc_login_next to below the AJAX return, this means AJAX requests will be redirected to the LOGIN_REDIRECT_URL instead of the API endpoint that generated the session refresh.

drwonky commented 1 year ago

See PR #364 for additional context. This is me cleaning up that PR, even if it's 3 years later :wink:

If I can remember rightly, this fix was needed because the flow should go to the LOGIN_REDIRECT_URL after re-authenticating. The problem is that if you catch the re-auths in your application, you don't want the browser being redirected to the REST endpoint that triggered the re-auth after authenticating. It would break the contract with the application.