2017 © Pedro Peláez
 

library laravelsocialiteapi

Social Login for Laravel API

image

pimplesushant/laravelsocialiteapi

Social Login for Laravel API

  • Thursday, June 21, 2018
  • by pimplesushant
  • Repository
  • 2 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Socialite API

A powerful package designed to implement social signup and signin using access_token in Laravel. This package takes care of Facebook and Google+ social signup and signin as of now. We'll be adding more services soon., (*1)

Installation

This package is availabe on composer. composer require pimplesushant/laravelsocialiteapi, (*2)

Alternatively you can edit your composer.json and add "pimplesushant/laravelsocialiteapi": "^1.0" and composer update, (*3)

Usage

To use this package you'll need to follow required steps of Laravel Passport. You can make following changes in files as follows :, (*4)

1. /.env, (*5)

DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
FACEBOOK_CLIENT_REDIRECT=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CLIENT_REDIRECT=
GOOGLE_DEVELOPER_KEY=

Then,, (*6)

php artisan migrate

and, (*7)

php artisan passport:install

2. /app/User.php, (*8)

use Laravel\Passport\HasApiTokens;
use HasApiTokens;

and, (*9)

public function social_accounts()
{
    return $this->hasMany(\Pimplesushant\Laravelsocialiteapi\SocialAccount::class)->with('social_accounts');
}

3. /app/Providers/AuthServicePorvider.php, (*10)

use Laravel\Passport\Passport;

and, (*11)

Passport::routes(); //in boot()

4. /config/auth.php, (*12)

'api' => [
    'driver' => 'passport',
    'provider' => 'users',
],

5. /config/services.php, (*13)

'facebook' => [
    'client_id' => env('FACEBOOK_CLIENT_ID'),
    'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
    'redirect' => env('FACEBOOK_CLIENT_REDIRECT')
],

'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    'redirect' => env('GOOGLE_CLIENT_REDIRECT')
]

Now you can serve the application and hit the route /social-login with provider (e.g. facebook, google) and access_token (Access token retrieved from social service providers), (*14)

License

Licensed under the MIT License, (*15)

Author

Pimple Suhsant (https://pimplesushant.in), (*16)

The Versions

21/06 2018

dev-master

9999999-dev

Social Login for Laravel API

  Sources   Download

The Requires

 

by Sushant Pimple

21/06 2018

1.0

1.0.0.0

Social Login for Laravel API

  Sources   Download

The Requires

 

by Sushant Pimple