PHPackages                             pbringetto/oauth2-snapchat - 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. pbringetto/oauth2-snapchat

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

pbringetto/oauth2-snapchat
==========================

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

19.4k1PHP

Since Oct 19Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

This package provides Snapchat 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 pbringetto/oauth2-snapchat

```

Credit
------

[](#credit)

This package has originally been coded and published by [ajibarra](https://github.com/ajibarra/oauth2-instagram) and has only been updated and optimized using the [oauth2-instagram package](https://github.com/thephpleague/oauth2-instagram).

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new League\OAuth2\Client\Provider\Snapchat([
    'clientId'          => '{snapchat-client-id}',
    'clientSecret'      => '{snapchat-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
        $user = $provider->getResourceOwner($token);

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

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

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 57.1% 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.

### Community

Maintainers

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

---

Top Contributors

[![pbringetto](https://avatars.githubusercontent.com/u/50182684?v=4)](https://github.com/pbringetto "pbringetto (4 commits)")[![hbastidas](https://avatars.githubusercontent.com/u/298644?v=4)](https://github.com/hbastidas "hbastidas (3 commits)")

### Embed Badge

![Health badge](/badges/pbringetto-oauth2-snapchat/health.svg)

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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