https://github.com/arviteri/oauth2middleware-facebook
Laravel package for securing API's with Facebook's OAuth2 service.
https://github.com/arviteri/oauth2middleware-facebook
Last synced: about 2 months ago
JSON representation
Laravel package for securing API's with Facebook's OAuth2 service.
- Host: GitHub
- URL: https://github.com/arviteri/oauth2middleware-facebook
- Owner: arviteri
- License: mit
- Created: 2018-08-12T03:19:21.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-16T03:25:26.000Z (over 6 years ago)
- Last Synced: 2025-02-07T12:35:21.932Z (4 months ago)
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
Install with composer: `composer require oauth2middleware/facebook`
## 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 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
##### The middleware alias is 'fb.auth'.
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 };
});