leondg / oidc-client
0.2.0
2024-10-11 15:42 UTC
Requires
- php: ^7.4 || ^8.0
- league/oauth2-client: ^2.0
- symfony/property-access: ^5.0 || ^6.0 || ^7.0
- symfony/serializer: ^5.0 || ^6.0 || ^7.0
README
This package provides OpenID Connect Well-Known Configuration support based on The PHP League's OAuth 2.0 Client.
Please note that this package is very basic and far from perfect
If you want to contribute or have suggestions you are welcome to provide them
Usage examples:
$discoverUri = 'https://auth.example.com/v2'; $clientId = 'your-client-id'; $clientSecret = 'your-client-secret'; $redirectUri = 'https://mywebsite.example.com/' $scopes = ['openid']; $config = WellKnownConfig::create($discoverUri); $provider = new OpenIDConnectProvider( $config, $clientId, $clientSecret, $redirectUri, $scopes );
[Recommended] If you want to use PKCE you can add the following constant:
$provider = new OpenIDConnectProvider( $config, $clientId, $clientSecret, $redirectUri, $scopes, OpenIDConnectProvider::PKCE_METHOD_S256 );
Now you can retrieve the authorization url with:
$provider->getAuthorizationUrl();
Here you can find more examples and basic usage:
https://oauth2-client.thephpleague.com/usage/