Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix - fix cookie vs token based client sessions #776

Merged
merged 3 commits into from
Feb 2, 2023
Merged

Conversation

shapiromatron
Copy link
Owner

@shapiromatron shapiromatron commented Jan 27, 2023

Fix a regression from #762.

We added the ability to login a request via the /myuser/api/validate-token/ endpoint. This can be useful with browsing the non-API website, but it breaks functionality on the API sdide because CSRF tokens are required (since it finds a valid django session, it uses that first, before falling back to tokens). While inconvenient in the context of this PR, this is desired behavior, (that is, checking session before token).

This PR adds a new optional query param to log the user in with a django session if specified, and the corresponding client parameter to specify it. By default, it's disabled and API token based sessions will be used.

@shapiromatron shapiromatron marked this pull request as ready for review January 27, 2023 23:38
Copy link
Collaborator

@munnsmunns munnsmunns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@shapiromatron shapiromatron merged commit 4937f4e into main Feb 2, 2023
@shapiromatron shapiromatron deleted the sessions branch February 2, 2023 20:44
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.

2 participants