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
I have been trying to implement PKCE with an unsupported provider (Zitadel) and had an issue with the authorization code exchange: the code challenge was always invalid (message invalid_grant, description invalid code challenge).
The OAuth2PKCEClient does generate a code challenge, but it is later overriden by league/oauth2-client AbstractProvider generating another one. As a result, the code challenge sent for authorization code exchange is not the same as before, hence the error.
With which provider is this OAuth2PKCEClient client class supposed to work?
The text was updated successfully, but these errors were encountered:
After a little further sought, I went to the conclusion that OAuth2PKCEClient should not be responsible for generating the PKCE code challenge. I will open a pull request with an alternative that works for my use-case.
After more testing, things got clearer and here is the summary of what I have learned.
The league/oauth2-client package added support for PKCE in its latest version (2.7). It can be enabled by setting the pkceMethod option on the provider.
The current implementation of this bundle (v2.15.0) works well with the latest league/oauth2-client package (2.7.0) as long as the pkceMethod option is not defined on the provider.
However, if defined, the pkceMethod option set on the provider will conflict with the OAuth2PKCEClient class: both the client and the provider will generate a random code challenge (and they won't match, and no access token can be retrieved).
Two options:
do not set the pkceMethod on the provider, it just works (the client class will be responsible of generating the code challenge)
Hi there,
I have been trying to implement PKCE with an unsupported provider (Zitadel) and had an issue with the authorization code exchange: the code challenge was always invalid (message
invalid_grant
, descriptioninvalid code challenge
).The
OAuth2PKCEClient
does generate a code challenge, but it is later overriden byleague/oauth2-client AbstractProvider
generating another one. As a result, the code challenge sent for authorization code exchange is not the same as before, hence the error.With which provider is this
OAuth2PKCEClient
client class supposed to work?The text was updated successfully, but these errors were encountered: