PHPackages                             luchianenco/oauth2-amazon - 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. luchianenco/oauth2-amazon

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

luchianenco/oauth2-amazon
=========================

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

3.0.0(3y ago)391.6k↓10.7%35MITPHPPHP ^8.0

Since Sep 8Pushed 3y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (2)Versions (12)Used By (5)

Amazon Provider for OAuth 2.0 Client
====================================

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

[![Latest Version](https://camo.githubusercontent.com/7ce889ad58ff18f544bf4e013b210e6482bdb352ba50644125c28a96d5645ed5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6c75636869616e656e636f2f6f61757468322d616d617a6f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/luchianenco/oauth2-amazon/releases)[![Build Status](https://camo.githubusercontent.com/8ee6e640a0e03602947b2f24239531356dd87b0948901dd8ee64092c06fb9ba0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c75636869616e656e636f2f6f61757468322d616d617a6f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/luchianenco/oauth2-amazon)[![Total Downloads](https://camo.githubusercontent.com/54d9ec420516b2caa66ffacb1bdb1bad96d03f1b887fd36b1f7390c56a057800/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c75636869616e656e636f2f6f61757468322d616d617a6f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luchianenco/oauth2-amazon)

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

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

[](#installation)

To install the package, use composer:

```
composer require luchianenco/oauth2-amazon

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Luchianenco\OAuth2\Client\Provider\Amazon([
    'clientId'          => '{amazon-client-id}',
    'clientSecret'      => '{amazon-client-secret}',
    'redirectUri'       => 'https://example.com/callback_url',
]);

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

...

// OAuth2 Callback URL
// Compare given state against previously stored one to block CSRF attack
if (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['OAuth2State'])) {

    exit('Invalid state');

} else {

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

    // Now we can look up users profile
    try {
        // Get the user's details
        $user = $provider->getResourceOwner($token);

        printf('Hello %s!', $user->getName());

    } catch (Exception $e) {
        // Failed to get user details
        exit('Oh no ... ...');
    }

    // We can use token to make other API calls
    echo $token->getToken();
}
```

Testing
-------

[](#testing)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~208 days

Recently: every ~467 days

Total

10

Last Release

1299d ago

Major Versions

1.1.2 → 2.0.02021-02-10

2.0.0 → 3.0.02022-10-28

PHP version history (4 changes)1.1.0PHP ^5.6 || ^7.0 || ^7.1

1.1.1PHP ^5.6 || ^7.0 || ^7.1 || ^8.0

2.0.0PHP &gt;=7.2

3.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![luchianenco](https://avatars.githubusercontent.com/u/3841383?v=4)](https://github.com/luchianenco "luchianenco (6 commits)")[![serghei-luchianenco](https://avatars.githubusercontent.com/u/53750162?v=4)](https://github.com/serghei-luchianenco "serghei-luchianenco (5 commits)")[![akira28](https://avatars.githubusercontent.com/u/996257?v=4)](https://github.com/akira28 "akira28 (1 commits)")

---

Tags

clientamazonAuthenticationoauthoauth2authorization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/luchianenco-oauth2-amazon/health.svg)

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

###  Alternatives

[league/oauth2-google

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

42121.2M118](/packages/league-oauth2-google)[cakedc/oauth2-cognito

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

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

PHPackages © 2026

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