Download the PHP package gicminos/laravel-passport-facebook-login without Composer
On this page you can find all versions of the php package gicminos/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 gicminos/laravel-passport-facebook-login. Use major version 1 for Passport 4 and below Laravel 5.6 compatibility.
Versions:
- Laravel 5.7, with Passport 5, 6 or 7.
Dependencies:
- laravel/passport:
5.0||6.0||7.0 - facebook/php-graph-sdk:
5.6
Setup:
- Add
Gicminos\PassportFacebookLogin\FacebookLoginGrantProvider::classto your list of providers afterLaravel\Passport\PassportServiceProvider. - Add
Gicminos\PassportFacebookLogin\FacebookLoginTraitTrait to yourUsermodel (or whatever model you have configured to work with Passport). - Run
php artisan vendor:publish, this will create aconfig/facebook.phpfile. - Enter your Facebook App details in your
.envfile:FACEBOOK_APP_IDandFACEBOOK_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_loginfb_token={token from facebook login}.- client_id
- client_secret
- An
access_tokenandrefresh_tokenwill be returned if successful.
Assumptions:
- Your
Usermodel has the folowing fields: -
facebook_id
-
nameorfirst_name&last_name
-
email
-
password
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.