PHPackages                             piercetech/coinbase-oauth2 - 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. piercetech/coinbase-oauth2

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

piercetech/coinbase-oauth2
==========================

Coinbase Provider for the OAuth 2.0 Client

0.1.0(7y ago)017PHP

Since Feb 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ctrlaltdylan/coinbase-oauth2)[ Packagist](https://packagist.org/packages/piercetech/coinbase-oauth2)[ RSS](/packages/piercetech-coinbase-oauth2/feed)WikiDiscussions master Synced yesterday

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

openclerk/coinbase-oauth2
=========================

[](#openclerkcoinbase-oauth2)

Implementation of a Coinbase API v2 OAuth 2.0 provider for the [league/oauth2-client](https://github.com/thephpleague/oauth2-client) client.

Installing
----------

[](#installing)

To install, use composer:

```
composer require piercetech/coinbase-oauth2

```

Usage
-----

[](#usage)

Usage is the same as the normal client, using `PierceTech\OAuth2\Client\Provider\Coinbase` as the provider:

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Openclerk\OAuth2\Client\Provider\Coinbase([
  'clientId'      => 'XXXXXXXX',
  'clientSecret'  => 'XXXXXXXX',
  'redirectUri'   => 'https://your-registered-redirect-uri/',
  'scopes'        => ['wallet:accounts:read', 'wallet:transactions:read', '...'],
]);

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

  // If we don't have an authorization code then get one
  $authUrl = $provider->getAuthorizationUrl();
  $_SESSION['oauth2state'] = $provider->state;
  header('Location: '.$authUrl);
  exit;

} 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
    $userDetails = $provider->getUserDetails($token);

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

  } catch (Exception $e) {

    // Failed to get user details
    exit('Oh dear...');
  }

  // Use this to interact with an API on the users behalf
  echo $token->accessToken;

  // Use this to get a new access token when the old one expires (2 hours from initial handshake)
  echo $token->refreshToken;

  // The Unix Epoch Timestamp when the Coinbase Token will expire
  echo $token->expires;
}
```

### Refreshing a Token

[](#refreshing-a-token)

```
$provider = new PierceTech\OAuth2\Client\Provider\Coinbase([
  'clientId'      => 'XXXXXXXX',
  'clientSecret'  => 'XXXXXXXX',
  'redirectUri'   => 'https://your-registered-redirect-uri/',
]);

$grant = new \League\OAuth2\Client\Grant\RefreshToken();
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
```

Testing
-------

[](#testing)

Since this requires user interaction, no actual Coinbase interaction testing is done, but some basic component quality tests can be run:

```
vendor/bin/phpunit

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

2642d ago

### Community

Maintainers

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

---

Top Contributors

[![soundasleep](https://avatars.githubusercontent.com/u/3889656?v=4)](https://github.com/soundasleep "soundasleep (5 commits)")

### Embed Badge

![Health badge](/badges/piercetech-coinbase-oauth2/health.svg)

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

###  Alternatives

[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

83416.7M61](/packages/knpuniversity-oauth2-client-bundle)[thenetworg/oauth2-azure

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

2509.6M48](/packages/thenetworg-oauth2-azure)[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)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

153.2M7](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

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