Skip to content

fix: authorization code error should be redirect #193

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

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

Conversation

TLG-Gildas
Copy link

According to the specification, errors on the authorize endpoint should be transmitted to the client via a redirect in certain conditions:

https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1

If the resource owner denies the access request or if the request
fails for reasons other than a missing or invalid redirection URI,
the authorization server informs the client by adding the following
parameters to the query component of the redirection URI using the
"application/x-www-form-urlencoded" format

This is not the case currently.
This PR seeks to resolve this case.

//
// so if redirectUri is not already set, we try to set request redirect_uri params, fallback to first redirectUri of client
/** @psalm-suppress RiskyTruthyFalsyComparison !empty($e->getHint()),empty($e->getRedirectUri()) we really want to check null and empty */
if (!empty($client)
Copy link
Member

Choose a reason for hiding this comment

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

please use explicit checks instead of empty()

Copy link
Author

Choose a reason for hiding this comment

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

explicit checks now used on $client

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I meant everywhere in the patch. I try to avoid using empty() for the reasons mentioned here.

Copy link
Author

Choose a reason for hiding this comment

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

ok no problem, I understand
new commit pushed

@TLG-Gildas
Copy link
Author

I just pushed a new commit to fix the coding standards, but the other bugs about static analysis and unit testing seem to be out of my scope.

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