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 2w 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 36% 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

2877d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12611183?v=4)[vittles](/maintainers/vittles)[@vittles](https://github.com/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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[overtrue/socialite

A collection of OAuth 2 packages.

1.4k5.6M90](/packages/overtrue-socialite)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

121242.9k1](/packages/ellaisys-aws-cognito)

PHPackages © 2026

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