Skip to content

fix session token storge in django 4.2 and higher#34

Open
tejon-melero wants to merge 2 commits intoAzMoo:mainfrom
tejon-melero:fix_session_token_storage_in_django_4_2_and_higher
Open

fix session token storge in django 4.2 and higher#34
tejon-melero wants to merge 2 commits intoAzMoo:mainfrom
tejon-melero:fix_session_token_storage_in_django_4_2_and_higher

Conversation

@tejon-melero
Copy link

No description provided.

@tejon-melero tejon-melero changed the title remove trailing slash from callback url config fix session token startoge in django 4.2 and higher Mar 22, 2024
@tejon-melero
Copy link
Author

This package stopped working after upgrading to Django 4.2 and higher but works with Django versions lower than 4.2
in Django versions 4.2 and higher the callback url that Okta connects to is no longer processed because the url definition of a callback url has an additional /:
https://github.com/AzMoo/django-okta-auth/blob/main/okta_oauth2/urls.py#L7
image

In the Readme of the project the callback url is defined without the slash:
image

Something in the url processing logic in Django has changed between versions 4.1 and 4.2 that led to the outcome that the callback view that sets the session tokens was no longer called and therefore the session tokens were no longer set.
Instead of setting the session token a redirect was triggered to the login page, which tried to call the callback url again and this lead to an infinite loop between the two views.

By removing the trailing slash from the callback url this issue is fixed and this fix is backwards compatible.

@tejon-melero tejon-melero changed the title fix session token startoge in django 4.2 and higher fix session token storge in django 4.2 and higher Mar 22, 2024
@kaskichandrakant
Copy link

kaskichandrakant commented Apr 11, 2024

#33 (comment) this solved my problem.

Co-authored-by: Danilo P <73405593+danilopsss@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants