PHPackages                             oauth2middleware/facebook - 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. oauth2middleware/facebook

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

oauth2middleware/facebook
=========================

Facebook OAuth2 security middleware for routes.

1.0.3(7y ago)020MITPHPPHP &gt;=5.5

Since Aug 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/arviteri/OAuth2Middleware-Facebook)[ Packagist](https://packagist.org/packages/oauth2middleware/facebook)[ RSS](/packages/oauth2middleware-facebook/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

OAuth2Middleware-Facebook
=========================

[](#oauth2middleware-facebook)

Laravel package for securing API's with Facebook's OAuth2 service.

OAuth2Middleware-Facebook works by verifying that each request sent to your server has an authorization token in the request `Authentication` header. After verifying that there is an authorization token available, it validates it against Facebook's Graph API. This validation has two steps; verifying that the token given belongs to Facebook, and verifying that the token belongs to YOUR Facebook application.

You will need to setup an application in Facebook as well as retrieve a non-expiring OAuth2 application token. (See configuration)

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

[](#installation)

Install with composer: `composer require oauth2middleware/facebook`

Configuration
-------------

[](#configuration)

The middleware requires two environment variables. (`FB_APP_TOKEN` and `FB_APP_ID`)
The `FB_APP_TOKEN` environment variable refers to a non-expiring application token which belongs to YOUR Facebook application.

##### Follow the instructions [here](https://developers.facebook.com/docs/facebook-login/access-tokens/#apptokens) to retrieve a Facebook app token.

[](#follow-the-instructions-here-to-retrieve-a-facebook-app-token)

The `FB_APP_ID` is your Facebook application's app Id. This can easily be found in the Facebook developer console.

Usage
-----

[](#usage)

##### The middleware alias is 'fb.auth'.

[](#the-middleware-alias-is-fbauth)

To use, use the `middleware` function on the routes that you want to protect.

For example...

```
Route::middleware('fb.auth')->get('/secure_route', function (Request $request) {
    // Your code...

    return { your_response_variable };
});

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

2831d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75732367383601c2bcf9f9937aabb8588d6a656140b9311dd1f2e3c165fe8c79?d=identicon)[vittles](/maintainers/vittles)

---

Top Contributors

[![arviteri](https://avatars.githubusercontent.com/u/12116673?v=4)](https://github.com/arviteri "arviteri (19 commits)")

### Embed Badge

![Health badge](/badges/oauth2middleware-facebook/health.svg)

```
[![Health](https://phpackages.com/badges/oauth2middleware-facebook/health.svg)](https://phpackages.com/packages/oauth2middleware-facebook)
```

###  Alternatives

[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[rahul900day/laravel-captcha

Different types of Captcha implementation for Laravel Application.

10715.9k](/packages/rahul900day-laravel-captcha)[simplesamlphp/simplesamlphp-module-oidc

A SimpleSAMLphp module adding support for the OpenID Connect protocol

5016.9k1](/packages/simplesamlphp-simplesamlphp-module-oidc)[kinde-oss/kinde-auth-php

Kinde PHP SDK for authentication

2369.5k3](/packages/kinde-oss-kinde-auth-php)[descope/descope-php

Descope SDK for PHP

3814.0k](/packages/descope-descope-php)[njoguamos/laravel-turnstile

A laravel wrapper for https://developers.cloudflare.com/turnstile/

2315.9k2](/packages/njoguamos-laravel-turnstile)

PHPackages © 2026

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