PHPackages                             micro/plugin-oauth2-client - 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. micro/plugin-oauth2-client

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

micro/plugin-oauth2-client
==========================

Micro Framework: OAuth2 client based on "league/oauth2-client"

1.0(3y ago)13681MITPHP

Since Dec 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Micro-PHP/plugin-oauth2-client)[ Packagist](https://packagist.org/packages/micro/plugin-oauth2-client)[ RSS](/packages/micro-plugin-oauth2-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (1)

Micro Framework Oauth2 client plugin
====================================

[](#micro-framework-oauth2-client-plugin)

Micro Framework: OAuth2 client based on "league/oauth2-client"

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

[](#installation)

Install plugin with composer

```
$ composer require micro/plugin-oauth2-client
```

And install a specific provider(s).

Available providers: micro/plugin-oauth2-client-keycloak

Аnd then add plugin to the list of plugins (etc/plugins.php)

```
$pluginsCommon = [
    //....OTHER PLUGINS ....
    Micro\Plugin\OAuth2\Client\OAuth2ClientPlugin::class,
    Micro\Plugin\OAuth2\Client\Keycloak\OAuth2KeycloakProviderPlugin::class,
];
```

Configure your oauth2 providers

The adapter configuration template usually looks like this `MICRO_OAUTH2__`

Default adapter name "default"

```
MICRO_OAUTH2_DEFAULT_TYPE=keycloak
MICRO_OAUTH2_DEFAULT_CLIENT_ID=
MICRO_OAUTH2_DEFAULT_CLIENT_SECRET=
MICRO_OAUTH2_DEFAULT_CLIENT_URL_AUTHORIZATION=
MICRO_OAUTH2_DEFAULT_CLIENT_URL_REDIRECT=
```

Usage/Examples
--------------

[](#usageexamples)

Index document

```
use use Micro\Plugin\OAuth2\Client\Facade\Oauth2ClientFacadeInterface;

/** Unauthorized user */
$client = $container->get(Oauth2ClientFacadeInterface::class);
$provider = $client->getProvider('default');

$provider->getAuthorizationUrl(); This method will return the full path to the server for user authorization.

/*** Response from the authorization server with a code */
$accessToken    = $provider->getAccessToken('authorization_code', [
    'code'  => $_GET['code'],
]);

$owner = $provider->getResourceOwner($accessToken);

$id = $owner->getId();
$ownerData = $owner->toArray(); //Associated data with the user.
```

Support
-------

[](#support)

For support, email .

Authors
-------

[](#authors)

- [@stanislau\_komar](https://www.github.com/asisyas)

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance58

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~186 days

Total

4

Last Release

681d ago

Major Versions

1.0 → 2.0.0-alpha2024-07-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/4942d7cf647e76c9a857f6d8ebb7197c1822999b2d696eb682adf464339eedc7?d=identicon)[Stanislau.Komar](/maintainers/Stanislau.Komar)

---

Top Contributors

[![Asisyas](https://avatars.githubusercontent.com/u/2931180?v=4)](https://github.com/Asisyas "Asisyas (2 commits)")

### Embed Badge

![Health badge](/badges/micro-plugin-oauth2-client/health.svg)

```
[![Health](https://phpackages.com/badges/micro-plugin-oauth2-client/health.svg)](https://phpackages.com/packages/micro-plugin-oauth2-client)
```

###  Alternatives

[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

83416.7M61](/packages/knpuniversity-oauth2-client-bundle)[thenetworg/oauth2-azure

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

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

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

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[microsoft/kiota-authentication-phpleague

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

153.2M7](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

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