PHPackages                             vdbelt/oauth2-revolut - 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. vdbelt/oauth2-revolut

ActiveLibrary

vdbelt/oauth2-revolut
=====================

Revolut Provider for OAuth 2.0 Client

v1.1.0(6mo ago)1104.5k—7%42MITPHPCI passing

Since Feb 10Pushed 6mo ago1 watchersCompare

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

READMEChangelog (7)Dependencies (5)Versions (8)Used By (2)

Revolut Provider for OAuth 2.0 Client
=====================================

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

[![Build Status](https://camo.githubusercontent.com/f74e18671f7aa8265a9bfe16714ce796ff4d9ede68efe44e4d6a35cac123d752/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766462656c742f6f61757468322d7265766f6c75742f63692e796d6c)](https://travis-ci.org/vdbelt/oauth2-revolut)[![Latest Version](https://camo.githubusercontent.com/d3f98a4e558e2d397a0c1d9c522acaafda01542e04b8f6060bd192d450cece61/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f766462656c742f6f61757468322d7265766f6c75742e7376673f7374796c653d666c61742d737175617265)](https://github.com/vdbelt/oauth2-revolut/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/80e2c4382167c0bbaa0be79bc3e94905a65b6e40c4ed6dfc525c3835d82836d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766462656c742f6f61757468322d7265766f6c75742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vdbelt/oauth2-revolut)

This package provides Revolut 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 vdbelt/oauth2-revolut

```

Usage
-----

[](#usage)

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

### Generating Key Pairs

[](#generating-key-pairs)

Start with generating a key pair as described in the [Revolut API docs](https://developer.revolut.com/docs/guides/manage-accounts/get-started/make-your-first-api-request#1-add-your-certificate):

```
openssl genrsa -out privatekey.pem 2048
openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825

```

Upload the public key through the Revolut for Business API Settings page, and store the private key somewhere safe.

### Authorization Code Flow

[](#authorization-code-flow)

```
$key = \Lcobucci\JWT\Signer\Key\InMemory::file('key.pem');
// or $key = \Lcobucci\JWT\Signer\Key\InMemory::plainText('privateKey');

$provider = new League\OAuth2\Client\Provider\Revolut([
    'clientId'          => '{revolut-client-id}',
    'privateKey'        => $key,
    'redirectUri'       => 'https://example.com/callback-url' // equal to redirect URI provided to Revolut
    'isSandbox'         => false
]);

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

    // Store the token somewhere safe. Note that the token is valid for 40 minutes.
    // After 40 minutes, you can request a new access token based on the refresh token (valid for 90 days):
    if($token->hasExpired()) {
        $newToken = $provider->getAccessToken('refresh_token', [
            'refresh_token' => $token->getRefreshToken()
        ]);
    }

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

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Martin van de Belt](https://github.com/vdbelt)
- [All Contributors](https://github.com/vdbelt/oauth2-revolut/contributors)

License
-------

[](#license)

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

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance66

Regular maintenance activity

Popularity35

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~349 days

Recently: every ~523 days

Total

7

Last Release

197d ago

### Community

Maintainers

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

---

Top Contributors

[![vdbelt](https://avatars.githubusercontent.com/u/11087503?v=4)](https://github.com/vdbelt "vdbelt (16 commits)")[![xPaw](https://avatars.githubusercontent.com/u/613331?v=4)](https://github.com/xPaw "xPaw (2 commits)")[![chalasr](https://avatars.githubusercontent.com/u/7502063?v=4)](https://github.com/chalasr "chalasr (1 commits)")[![grubitz](https://avatars.githubusercontent.com/u/26676163?v=4)](https://github.com/grubitz "grubitz (1 commits)")

---

Tags

oauth2oauth2-clientphprevolut

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/vdbelt-oauth2-revolut/health.svg)

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[league/oauth2-google

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

42121.2M118](/packages/league-oauth2-google)[patrickbussmann/oauth2-apple

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

1132.5M6](/packages/patrickbussmann-oauth2-apple)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)

PHPackages © 2026

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