bigpaulie/laravel-social-passport

Adds additional grant types to Laravel's Passport library

dev-master 2018-01-11 11:38 UTC

This package is auto-updated.

Last update: 2024-11-29 05:27:14 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

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

  • Facebook

Basic usage

By using the package I assume that you've already installed and configured laravel/passport package.

Facebook

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