You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
I came across the need to send a value from the authorization request through to the authorization response. Outlined here, using the state parameter is the correct way to send values from the request to the response. This state parameter helps mitigate CSRF attacks
I changed the authorize and login functions to accept an optional state parameter.
Please note, I also bumped the package version as well. 2.0.7 -> 2.0.8
I'm not really good at react but I have some questions. I see that if you do not provide the state to the login function, it is not sent by default. Maybe the default behavior should be sending the state even when it is not specified, like a random string. Because if the authorization server does not implement PKCE, i guess state is one of the few ways to protect against XSS? And of course, in that case, i believe it should be also checked if the sent value is equal to the one server responded back.
And also, the authorization server that I use does not accept the request if it does not have state value in. I don't know if it is common but it might save some trouble to other people as well. Maybe, the state should always be sent and checked but if you like to use it for redirect, you should still be able to do it which I believe this implementation lets you do it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
I came across the need to send a value from the authorization request through to the authorization response. Outlined here, using the state parameter is the correct way to send values from the request to the response. This
stateparameter helps mitigate CSRF attacksI changed the
authorizeandloginfunctions to accept an optional state parameter.Please note, I also bumped the package version as well.
2.0.7->2.0.8