PHPackages                             vormkracht10/oauth2-genesys - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. vormkracht10/oauth2-genesys

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

vormkracht10/oauth2-genesys
===========================

This package provides Genesys OAuth 2.0 support for the PHP League's OAauth 2.0 Client

v0.2.4(2y ago)12.1k↓70.1%[1 PRs](https://github.com/vormkracht10/oauth2-genesys/pulls)MITPHPPHP ^8.0CI passing

Since Oct 10Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/vormkracht10/oauth2-genesys)[ Packagist](https://packagist.org/packages/vormkracht10/oauth2-genesys)[ Docs](https://github.com/vormkracht10/oauth2-genesys)[ GitHub Sponsors](https://github.com/vormkracht10)[ RSS](/packages/vormkracht10-oauth2-genesys/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (7)Versions (10)Used By (0)

Genesys Provider for OAauth 2.0 Client
======================================

[](#genesys-provider-for-oaauth-20-client)

[![GitHub release (latest by date)](https://camo.githubusercontent.com/bdce89eb746b2fe58af60bf073ef8fae70042b619618f44fc8e8fbbe7a6a3ee3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f766f726d6b726163687431302f6f61757468322d67656e65737973)](https://camo.githubusercontent.com/bdce89eb746b2fe58af60bf073ef8fae70042b619618f44fc8e8fbbe7a6a3ee3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f766f726d6b726163687431302f6f61757468322d67656e65737973)[![Tests](https://github.com/vormkracht10/oauth2-genesys/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/vormkracht10/oauth2-genesys/actions/workflows/run-tests.yml)[![Packagist PHP Version Support](https://camo.githubusercontent.com/9bbed8ba626d422f15fed69db29a4f86fb7d6b5c7359d93980289a625cc13980/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f766f726d6b726163687431302f6f61757468322d67656e65737973)](https://camo.githubusercontent.com/9bbed8ba626d422f15fed69db29a4f86fb7d6b5c7359d93980289a625cc13980/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f766f726d6b726163687431302f6f61757468322d67656e65737973)[![Latest Version on Packagist](https://camo.githubusercontent.com/32ba0e7b37d7e2274793ff57c8f0e86d75f4652f77f29d9d5bf3999edefb0647/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f726d6b726163687431302f6f61757468322d67656e657379732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vormkracht10/oauth2-genesys)[![Total Downloads](https://camo.githubusercontent.com/aed04afc678be9e08905ba2f27e16a69c80d3ce5bf70d82bdd61fc07e8dcb039/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766f726d6b726163687431302f6f61757468322d67656e657379732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vormkracht10/oauth2-genesys)

This package provides Genesys OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require vormkracht10/oauth2-genesys
```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Vormkracht10\OAuth2Genesys\Provider\Genesys` as the provider.

### Defining the region

[](#defining-the-region)

Because Genesys uses different endpoints for different regions, you need to define the region you want to use. This can be done by passing the region as parameter to the constructor. By default the region is set to `us-east-1`. All regions and their endpoints can be found in the Genesys API documentation [here](https://developer.genesys.cloud/platform/api/).

### Authorization Code Flow

[](#authorization-code-flow)

```
require_once('./vendor/autoload.php');
session_start();

$provider = new \Vormkracht10\OAuth2Genesys\Provider\Genesys([
    'region'            => 'us-west-2',
    'clientId'          => '{genesys-client-id}',
    'clientSecret'      => '{genesys-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Bas van Dinther](https://github.com/vormkracht10)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance48

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~84 days

Recently: every ~125 days

Total

7

Last Release

858d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c6a425dc8645907a118a007438172d58c2016773f54ab3a834beff172632f13?d=identicon)[ux](/maintainers/ux)

---

Top Contributors

[![Baspa](https://avatars.githubusercontent.com/u/10845460?v=4)](https://github.com/Baspa "Baspa (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![markvaneijk](https://avatars.githubusercontent.com/u/1925388?v=4)](https://github.com/markvaneijk "markvaneijk (1 commits)")[![Ynitial](https://avatars.githubusercontent.com/u/35238373?v=4)](https://github.com/Ynitial "Ynitial (1 commits)")

---

Tags

genesysgenesys-cloudoauth2oauth2-clientphpphp-leaguephpleaguevormkracht10oauth2-genesys

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vormkracht10-oauth2-genesys/health.svg)

```
[![Health](https://phpackages.com/badges/vormkracht10-oauth2-genesys/health.svg)](https://phpackages.com/packages/vormkracht10-oauth2-genesys)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

25310.7M83](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2306.4M45](/packages/stevenmaguire-oauth2-keycloak)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)[ekapusta/oauth2-esia

Allows to authenticate in ESIA and get authenticated individual personal information.

74195.7k1](/packages/ekapusta-oauth2-esia)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

154.1M9](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
