PHP library to authenticate users against an identity provider using the OpenId Connect protocol.
Use cases implemented:
- Authentication using the Authorization Code Flow
- Refreshing access token with refresh token
- PHP 5.6 or greater
- CURL extension
- JSON extension
Composer
composer require raegmaen/openid-connect-php
$openIdConnectClient = OpenIdConnectFactory::create(
$providerUrl,
$clientId,
$clientSecret,
$callbackUrl
);
$authenticationResult = $this->openIdConnectClient->authenticate($requestData);
if ($authenticationResult instanceof UserRedirect) {
// Redirect user to given Url
}
$claims = $authenticationResult->getIdToken()->getClaims();
$name = $claims->get('given_name');