PHPackages                             webinarium/oauth2-linode - 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. webinarium/oauth2-linode

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

webinarium/oauth2-linode
========================

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

1.0.0(7y ago)153MITPHPPHP ^5.6|^7.0

Since Oct 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/webinarium/oauth2-linode)[ Packagist](https://packagist.org/packages/webinarium/oauth2-linode)[ Docs](https://github.com/webinarium/oauth2-linode)[ RSS](/packages/webinarium-oauth2-linode/feed)WikiDiscussions master Synced 2mo ago

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

Linode Provider for OAuth 2.0 Client
====================================

[](#linode-provider-for-oauth-20-client)

[![PHP](https://camo.githubusercontent.com/f158ce25773c5cfb6d45aa8d5887425f0102ecebbfc0696aa32d213b00e7245a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e362532422d626c75652e737667)](https://secure.php.net/migration56)[![Latest Stable Version](https://camo.githubusercontent.com/594b50ca56c3b929014038725c2589dbbf37634f5c730153fbe8d97d55aa031b/68747470733a2f2f706f7365722e707567782e6f72672f776562696e617269756d2f6f61757468322d6c696e6f64652f762f737461626c65)](https://packagist.org/packages/webinarium/oauth2-linode)[![Build Status](https://camo.githubusercontent.com/2853ad05c735988335d6ad28da1858ffaf9f8a6c728c7ca88cddcaae83069e75/68747470733a2f2f7472617669732d63692e6f72672f776562696e617269756d2f6f61757468322d6c696e6f64652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webinarium/oauth2-linode)[![Code Coverage](https://camo.githubusercontent.com/2cc0ba0f976d2764cc2384a849678093249f6f93de1eec4332e179d0d4cb0abc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f776562696e617269756d2f6f61757468322d6c696e6f64652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/webinarium/oauth2-linode/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/077a475489389913c875fe61ea351830e55386ce9482eedc04f26e27b6f59438/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f776562696e617269756d2f6f61757468322d6c696e6f64652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/webinarium/oauth2-linode/?branch=master)

This package provides Linode 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 webinarium/oauth2-linode
```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Linode\OAuth2\Client\Provider\Linode([
    'clientId'     => '{linode-client-id}',
    'clientSecret' => '{linode-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
        /** @var \Linode\OAuth2\Client\Provider\LinodeResourceOwner $owner */
        $user = $provider->getResourceOwner($token);

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

    } 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();
}
```

### Managing Scopes

[](#managing-scopes)

When creating your Linode authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => [
        Linode\OAuth2\Client\Provider\Linode::SCOPE_ACCOUNT_READ_ONLY,
        Linode\OAuth2\Client\Provider\Linode::SCOPE_LINODES_READ_WRITE,
    ]
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

At the time of authoring this documentation, the [following scopes are available](https://developers.linode.com/api/v4#section/OAuth):

- SCOPE\_ACCOUNT\_READ\_ONLY
- SCOPE\_ACCOUNT\_READ\_WRITE
- SCOPE\_DOMAINS\_READ\_ONLY
- SCOPE\_DOMAINS\_READ\_WRITE
- SCOPE\_EVENTS\_READ\_ONLY
- SCOPE\_EVENTS\_READ\_WRITE
- SCOPE\_IMAGES\_READ\_ONLY
- SCOPE\_IMAGES\_READ\_WRITE
- SCOPE\_IPS\_READ\_ONLY
- SCOPE\_IPS\_READ\_WRITE
- SCOPE\_LINODES\_READ\_ONLY
- SCOPE\_LINODES\_READ\_WRITE
- SCOPE\_LONGVIEW\_READ\_ONLY
- SCOPE\_LONGVIEW\_READ\_WRITE
- SCOPE\_NODEBALANCERS\_READ\_ONLY
- SCOPE\_NODEBALANCERS\_READ\_WRITE
- SCOPE\_STACKSCRIPTS\_READ\_ONLY
- SCOPE\_STACKSCRIPTS\_READ\_WRITE
- SCOPE\_VOLUMES\_READ\_ONLY
- SCOPE\_VOLUMES\_READ\_WRITE

Development
-----------

[](#development)

```
./bin/php-cs-fixer fix
./bin/phpunit --coverage-text
```

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/webinarium/oauth2-linode/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Artem Rodygin](https://github.com/webinarium)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/webinarium/oauth2-linode/blob/master/LICENSE) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

2770d ago

### Community

Maintainers

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

---

Top Contributors

[![webinarium](https://avatars.githubusercontent.com/u/741349?v=4)](https://github.com/webinarium "webinarium (7 commits)")

---

Tags

linodeoauth2phpclientoauthoauth2authorizationauthorisationlinode

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/webinarium-oauth2-linode/health.svg)

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

###  Alternatives

[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)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

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

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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