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

Fix "state" parameter of error responses #1298

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

hafezdivandari
Copy link

@hafezdivandari hafezdivandari commented Sep 8, 2022

According to RFC 6749 on error response of the implicit grant, the authorization server should add parameters to the fragment component of the redirection URI and the state parameter is required if it was present on the request.

There already 2 error responses that have redirect URI:

  • Invalid_scope:
    • The error parameters were already on fragment component when using implicit grant as expected, but this error response doesn't include the state parameter when redirecting. This PR fixes this on both 'auth code' and 'implicit' grants.
    • Auth code grant:
      • before: http://example.com/callback?error=access_denied&error_description=...
      • after: http://example.com/callback?state=123&error=access_denied&error_description=...
    • Implicit grant:
      • before: http://example.com/callback#error=access_denied&error_description=...
      • after: http://example.com/callback#state=123&error=access_denied&error_description=...
  • access_denied: This error response does include the state parameter when redirecting as expected, but when using implicit grant, the error's state parameter is on query string and other parameters were on fragment component. This PR fixes this.
    • Before: http://example.com/callback?state=123#error=access_denied&error_description=...
    • After: http://example.com/callback#state=123&error=access_denied&error_description=...

@Sephster
Copy link
Member

Sephster commented Sep 8, 2022

Please can you provide some information about why you want to add this change? Thank you

@hafezdivandari
Copy link
Author

hafezdivandari commented Sep 8, 2022

I added description I hope it is clear enough.

@hafezdivandari
Copy link
Author

Just merged master into this and resolved conflicts.

@hafezdivandari hafezdivandari changed the title Use fragment for error response on implicit grant Fix "state" parameter of error responses Oct 3, 2024
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