PHPackages                             zestsoftware/oauth2-client-odoo - 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. zestsoftware/oauth2-client-odoo

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

zestsoftware/oauth2-client-odoo
===============================

Odoo OAuth2-Server Client Provider for The PHP League OAuth2-Client

1.0.1(8y ago)1262[1 issues](https://github.com/zestsoftware/oauth2-client-odoo/issues)MITPHP

Since Feb 27Pushed 8y agoCompare

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

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Odoo OAuth2-Server support for the PHP League's OAuth 2.0 Client
================================================================

[](#odoo-oauth2-server-support-for-the-php-leagues-oauth-20-client)

[![Build Status](https://camo.githubusercontent.com/4a45bd01a8870380574602402bd635f520fa96b8c7f66968d1872494c8ce6711/68747470733a2f2f7472617669732d63692e6f72672f7a657374736f6674776172652f6f61757468322d636c69656e742d6f646f6f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/zestsoftware/oauth2-client-odoo)

This package provides Odoo OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

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

[](#installation)

To install, use composer:

```
composer require zestsoftware/oauth2-client-odoo

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\ZestSoftware\OAuth2\Client\Provider\Odoo` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

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

$provider = new \ZestSoftware\OAuth2\Client\Provider\Odoo([
    'clientId'          => '{Odoo-client-id}',
    'clientSecret'      => '{Odoo-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'baseUrl'           => 'https://example.com',
]);

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

        // Use these details to create a new profile
        printf('Hello %s!', $user->getName());

    } 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)

```
$ ./vendor/bin/phpunit
```

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

[](#contributing)

Please see [CONTRIBUTING](https://bitbucket.com/zestsoftware/oauth2-client-odoo/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Jean-Paul Ladage](https://bitbucket.com/zestsoftware/oauth2-client-odoo)
- [All Contributors](https://bitbucket.com/zestsoftware/oauth2-client-odoo/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://bitbucket.com/zestsoftware/oauth2-client-odoo/blob/master/LICENSE) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~1 days

Total

3

Last Release

2990d ago

Major Versions

0.1 → 1.02018-02-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7361027bb1e2e13e3092aa1ee630800815c066842b4cd9090b749548b6264d3?d=identicon)[jladage](/maintainers/jladage)

---

Top Contributors

[![jladage](https://avatars.githubusercontent.com/u/600459?v=4)](https://github.com/jladage "jladage (11 commits)")

---

Tags

AuthenticationSSOidentityoauthoauth2authorizationidpsingle sign onodoo

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/zestsoftware-oauth2-client-odoo/health.svg)

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

###  Alternatives

[adam-paterson/oauth2-slack

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

22694.8k5](/packages/adam-paterson-oauth2-slack)

PHPackages © 2026

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