- Issue created by @lieb
- πΊπΈUnited States lieb
I got it working with one mod
src/Plugin/Oauth2Client/Oauth2ClientPluginBase.php
public function getProvider(): AbstractProvider { return new GenericProvider( [ ... 'pkceMethod' => \League\OAuth2\Client\Provider\GenericProvider::PKCE_METHOD_S256, ],
However I am not storing and retrieving the code as per the documentation
From the documentation - https://oauth2-client.thephpleague.com/usage/
$provider = new \League\OAuth2\Client\Provider\GenericProvider([
// ... // other options // ... 'pkceMethod' => \League\OAuth2\Client\Provider\GenericProvider::PKCE_METHOD_S256 ]);
The PKCE code needs to be used between requests and therefore be saved and restored, usually via the session. In the example above this is done as follows:
// Store the PKCE code after the `getAuthorizationUrl()` call. $_SESSION['oauth2pkceCode'] = $provider->getPkceCode(); // ... // Restore the PKCE code before the `getAccessToken()` call. $provider->setPkceCode($_SESSION['oauth2pkceCode']);
- πΊπΈUnited States fathershawn New York
Hi - That's precisely the approach - to customize the provider as you need in your implementation!
For storage you can you use similar methods to the token storage and use which ever method you chose for that to store this code.
I plan to switch to the new GitLab pages soon - thank you for this question as it will be a good case to document.
- πΊπΈUnited States fathershawn New York
I've given this some thought and want to make this easier for users to implement.