PHPackages                             bybrand/oauth2-frontapp - 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. bybrand/oauth2-frontapp

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

bybrand/oauth2-frontapp
=======================

FrontApp Provider for PHP League's OAuth 2.0 Client

v0.1.1(3y ago)2105MITPHP

Since May 19Pushed 3y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (3)Used By (0)

FrontApp Provider for PHP OAuth 2.0 Client
==========================================

[](#frontapp-provider-for-php-oauth-20-client)

This package provides FrontApp OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client). Initially, this module was used for the integration of [Bybrand](https://www.bybrand.io) with Front and is in production, but probably works for all needs.

The core documentation can be found in the [Front documentation](https://dev.frontapp.com/docs/core-api-overview). Also, you can read the [Intro to Front OAuth](https://dev.frontapp.com/docs/oauth).

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

[](#installation)

```
composer require bybrand/oauth2-frontapp

```

Usage
-----

[](#usage)

This is a instruction base to get the token and refresh\_token, and in then, to save in your database to future request.

```
use Bybrand\OAuth2\Client\Provider\FrontApp as ProviderFrontApp;

$params = $_GET;

$provider = new ProviderFrontApp([
    'clientId'    => 'key-id',
    'redirectUri' => 'your-url-redirect'
]);

if (!isset($params['code']) or empty($params['code'])) {
    // If we don't have an authorization code then get one
    $authorizationUrl = $provider->getAuthorizationUrl();

    // Get state and store it to the session
    $_SESSION['oauth2state'] = $provider->getState();

    header('Location: '.$authorizationUrl);
    exit;
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($params['state']) || ($params['state'] !== $_SESSION['oauth2state'])) {
    unset($_SESSION['oauth2state']);

    // Set error and redirect.
    echo 'Invalid stage';
} else {
    try {
        // Try to get an access token (using the authorization code grant)
        $token = $provider->getAccessToken('client_credentials', [
            'code' => $params['code']
        ]);
    } catch (\Exception $e) {
        // Error, make redirect or message.
    }

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

```

Please, for more information see the PHP League's general usage examples.

Refreshing a Token
------------------

[](#refreshing-a-token)

Pending of docs.

Testing
-------

[](#testing)

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

```

License
-------

[](#license)

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

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Every ~1 days

Total

2

Last Release

1459d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0db1c7d7836cb218fe710bb074fa076dad1961a92e31ccbf6e7528ab7a8d07cf?d=identicon)[bybrand](/maintainers/bybrand)

---

Top Contributors

[![ursoforte](https://avatars.githubusercontent.com/u/578063?v=4)](https://github.com/ursoforte "ursoforte (3 commits)")

---

Tags

phpapiAuthenticationoauth2authorizationfrontapp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bybrand-oauth2-frontapp/health.svg)

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

###  Alternatives

[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

194.1k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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