bigpaulie / laravel-social-passport
Adds additional grant types to Laravel's Passport library
Requires
- abraham/twitteroauth: ^0.7.4
- facebook/graph-sdk: ^5.6
- laravel/passport: ^4.0
Requires (Dev)
- illuminate/session: ^5.5
- mockery/mockery: ^1.0
- phpunit/phpunit: ^6.4
This package is auto-updated.
Last update: 2024-10-29 05:22:24 UTC
README
This project is ideal for applications where the front-end is decoupled from the back-end such as vue.js, angular, cordova, etc. Providing stateless social authentication via Laravel's Passport library.
Installation
Install social passport via composer
composer require bigpaulie/laravel-social-passport
Publish package resources.
php artisan vendor:publish
Run the migrations
php artisan migrate
Supported networks
Basic usage
By using the package I assume that you've already installed and configured laravel/passport package.
At this moment I assume that your user table has a first_name and a last_name column, the migration file will automatically add a facebook_id column.
Add the FacebookPassportProvider to you config/app.php providers array
\Bigpaulie\Laravel\Social\Passport\FacebookPassportProvider::class,
Add the SocialPassport contract to your user model.
use SocialPassport;
From this moment onward you are ready to use Facebook's access token to authenticate your users.
Send a POST request to oauth/token with the following body
{ "grant_type": "facebook_login", "client_id": "<passport_client_id>", "client_secret": "<passport_client_secret>", "facebook_token": "<facebook_access_token>" }
Pay attention to the "grant_type" key
Dependencies
In order for this project to function properly some extra packages are needed.
Road map
The following features will be added in the future.
- Twitter authentication
- Github authentication
- Google authentication
- Events
Contributions
Contributions are most welcomed as long as you follow the existing code style and testing pattern.
Please feel free to fork, code and submit a pull request