PHPackages                             kangaroorewards/oauth2-kangaroo-rewards - 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. kangaroorewards/oauth2-kangaroo-rewards

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

kangaroorewards/oauth2-kangaroo-rewards
=======================================

Kangaroo Rewards OAuth 2.0 Client Provider for The PHP League OAuth2-Client

v2.1.0(3y ago)11901MITPHPPHP ^5.6 || ^7.0 || ^8.0CI passing

Since Nov 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kangaroorewards/oauth2-kangaroo-rewards)[ Packagist](https://packagist.org/packages/kangaroorewards/oauth2-kangaroo-rewards)[ RSS](/packages/kangaroorewards-oauth2-kangaroo-rewards/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (5)Versions (9)Used By (0)

Kangaroo Rewards Provider for OAuth 2.0 Client
==============================================

[](#kangaroo-rewards-provider-for-oauth-20-client)

[![Build Status](https://camo.githubusercontent.com/f85cba1539228f11911d4bce9e1e9264faeee00091b1d891e1c01833501a5991/68747470733a2f2f7472617669732d63692e6f72672f6b616e6761726f6f726577617264732f6f61757468322d6b616e6761726f6f2d726577617264732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kangaroorewards/oauth2-kangaroo-rewards)[![Latest Version](https://camo.githubusercontent.com/6bc2a20c76897b6f454e5ab6fe19072b6ef58a24afe38e49325a59261b626441/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6b616e6761726f6f726577617264732f6f61757468322d6b616e6761726f6f2d726577617264732e7376673f7374796c653d666c61742d737175617265)](https://github.com/kangaroorewards/oauth2-kangaroo-rewards/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

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

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md), and [PSR-7](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md). If you notice compliance oversights, please send a patch via pull request.

Requirements
------------

[](#requirements)

The following versions of PHP are supported.

- PHP 5.6
- PHP 7.1
- PHP 7.2
- PHP 7.3
- PHP 7.4
- PHP 8.0

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

[](#installation)

Add the following to your `composer.json` file.

```
{
    "require": {
        "kangaroorewards/oauth2-kangaroo-rewards": "~2.0"
    }
}
```

Usage
-----

[](#usage)

### Authorization Code Flow

[](#authorization-code-flow)

```
session_start();

$provider = new KangarooRewards\OAuth2\Client\Provider\Kangaroo([
    'clientId' => CLIENT_ID,
    'clientSecret' => CLIENT_SECRET,
    'redirectUri' => REDIRECT_URI,
]);

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

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

    echo 'Log in with Kangaroo Rewards!';
    exit;

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

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

}

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

try {

    // We got an access token, let's make some requests
    $resourceOwner = $kangaroo->getResourceOwner($token);

    $http = new GuzzleHttp\Client;
    $response = $http->get('https://api.kangaroorewards.com/customers', [
        'headers' => [
            'User-Agent' => '{Client Name}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/vnd.kangaroorewards.api.v1+json;',
            'Authorization' => 'Bearer ' . $token->getToken(),
        ]
    ]);
    $r = json_decode((string) $response->getBody(), true);

    echo '';
    var_export($resourceOwner->toArray());
    var_export($r);
    echo '';

} catch (Exception $e) {
    exit($e->getMessage());
}

echo '';
// Use this to interact with the API on the client behalf
var_dump($token->getToken());

echo '';
```

Testing
-------

[](#testing)

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

Style checks can be run with:

```
./vendor/bin/phpcbf src --standard=psr12 -p
./vendor/bin/phpcs src --standard=psr12 -sp
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Valentin Ursuleac](https://github.com/ursuleacv)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 70.6% 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 ~335 days

Recently: every ~544 days

Total

8

Last Release

1170d ago

Major Versions

v1.0.5 → v2.0.02021-05-15

PHP version history (3 changes)v1.0.0PHP &gt;=5.5.0

v1.0.4PHP &gt;=5.6.0

v2.0.0PHP ^5.6 || ^7.0 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22822970?v=4)[Kangaroo Rewards](/maintainers/KangarooRewards)[@kangaroorewards](https://github.com/kangaroorewards)

---

Top Contributors

[![ursuleacv](https://avatars.githubusercontent.com/u/1458222?v=4)](https://github.com/ursuleacv "ursuleacv (24 commits)")[![kangaroo-val](https://avatars.githubusercontent.com/u/22823136?v=4)](https://github.com/kangaroo-val "kangaroo-val (9 commits)")[![kangaroodev](https://avatars.githubusercontent.com/u/22823309?v=4)](https://github.com/kangaroodev "kangaroodev (1 commits)")

---

Tags

kangaroo-rewardsoauth2oauth2-providerphpphp-leagueclientAuthenticationoauthoauth2authorizationloyaltykangarooKangaroo Rewards

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kangaroorewards-oauth2-kangaroo-rewards/health.svg)

```
[![Health](https://phpackages.com/badges/kangaroorewards-oauth2-kangaroo-rewards/health.svg)](https://phpackages.com/packages/kangaroorewards-oauth2-kangaroo-rewards)
```

###  Alternatives

[league/oauth2-google

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

42222.6M159](/packages/league-oauth2-google)[thenetworg/oauth2-azure

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

25310.7M73](/packages/thenetworg-oauth2-azure)[cakedc/oauth2-cognito

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

18623.5k](/packages/cakedc-oauth2-cognito)

PHPackages © 2026

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