raegmaen/openid-connect-php

OpenID Connect client

Installs: 19 019

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 0

Forks: 393

Open Issues: 1

pkg:composer/raegmaen/openid-connect-php

0.2.1 2018-11-21 13:28 UTC

This package is not auto-updated.

Last update: 2025-10-12 10:11:48 UTC


README

PHP library to authenticate users against an identity provider using the OpenId Connect protocol.
Use cases implemented:

  1. Authentication using the Authorization Code Flow
  2. Refreshing access token with refresh token

Requirements

  1. PHP 5.6 or greater
  2. CURL extension
  3. JSON extension

Install

Composer

composer require raegmaen/openid-connect-php

License

Apache License, Version 2.0

Example:

$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');