Download the PHP package sergeiten/laravel-passport-facebook-login without Composer
On this page you can find all versions of the php package sergeiten/laravel-passport-facebook-login. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-passport-facebook-login
Laravel Passport Facebook Login
Provides a new Laravel Passport Grant Client named facebook_login
, allowing you to log a user in with just their Facebook Login token.
A new user will be created (and optionally assigned to an role - $user->attachRole(ID)
) if the email address doesn't exist.
Installation:
Install with composer composer require sergeiten/laravel-passport-facebook-login
. Use major version 1 for Passport 4 and below Laravel 5.6 compatibility.
Versions:
- Laravel 5.6 and Passport 5.0 only supported at this time
Dependencies:
"laravel/passport": "~5.0"
"facebook/graph-sdk": "~5.6"
Setup:
- Add
SergeiTen\PassportFacebookLogin\FacebookLoginGrantProvider::class
to your list of providers afterLaravel\Passport\PassportServiceProvider
. - Add
SergeiTen\PassportFacebookLogin\FacebookLoginTrait
Trait to yourUser
model (or whatever model you have configured to work with Passport). - Run
php artisan vendor:publish
, this will create aconfig/facebook.php
file. - Enter your Facebook App details in your
.env
file:FACEBOOK_APP_ID
andFACEBOOK_APP_SECRET
. - Optional: To automatically attach a role (https://github.com/Zizaco/entrust) to new users, use the 'ATTACH_ROLE' env setting.
Config:
How To Use:
- Make a POST request to
https://your-site.com/oauth/token
. - The POST body should contain
grant_type
=facebook_login
fb_token
={token from facebook login}
.- client_id
- client_secret
- An
access_token
andrefresh_token
will be returned if successful.
Assumptions:
- Your
User
model has the following fields: -
facebook_id
-
name
orfirst_name
&last_name
-
email
-
password
-
picture
facebook user picture
Why not use Laravel 5.5's auto-discovery?
We have found that using auto discovery can cause issues as this package relies on Laravel Passport been loaded before this package. Sometimes this doesn't happen, and caused issues as Laravel Passport sets up a singleton we reference.
We hope that one day there will be a fix to Laravel auto-discovery that will allow for dependencies to be handled better.