2017 © Pedro Peláez
 

laravel-package laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

image

mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  • Thursday, July 19, 2018
  • by Mckenziearts
  • Repository
  • 2 Watchers
  • 31 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

, (*1)

Latest Version on Packagist ![Total Downloads][ico-downloads] Build Status Scrutinizer Code Quality StyleCI, (*2)

Introduction

Social OAuth authentication for Laravel 5 which provides oAuth support in PHP 5.3+ and is very easy to integrate with any project which requires an oAuth client. This package use Laravel Socialite. For Laravel 4 look this package, (*3)

Supported services

The library supports OAuth 2.0 compliant services. A list of currently implemented services can be found below. More services will be implemented soon., (*4)

Included service implementations:, (*5)

  • OAuth2
    • Facebook
    • GitHub
    • Google
    • Instagram
    • LinkedIn
    • Bitbucket
    • Twitter
    • Dribbble
    • Pinterest
    • Youtube
    • Gitlab
  • more to come!

Laravel Support version, (*6)

Laravel laravel-oauth
<=5.5 ^1.0
6.0 ^1.1

Installation

  1. Include the package in your project using Composer, (*7)

    shell $ composer require mckenziearts/laravel-oauth, (*8)

  2. Add the service provider to your config/app.php providers array:, (*9)

    For Laravel 5.5.+ - you're done., (*10)

    Mckenziearts\LaravelOAuth\LaravelOAuthServiceProvider::class,
    
  3. Publish the Vendor Assets files by running:, (*11)

    php artisan vendor:publish --provider="Mckenziearts\LaravelOAuth\LaravelOAuthServiceProvider"
    
  4. Now that we have published a few new files to our application we need to reload them with the following command:, (*12)

    composer dump-autoload
    

Configuration

When you published the vendor assets you added a new file inside of your config folder which is called config/laravel-oauth.php. This file contains a bunch of configuration you can use to configure your connexion using social networks., (*13)

First, you have to add your service like is defined on The official documentation of Socialite available here. Just setup your Oauth services for your application. Laravel/socialite is automatically installed by this package., (*14)

Usage

  1. Fisrt of all in the config/laravel-oauth.php file you must define the default users table name to simplify migrations. By default users table is used, (*15)

    'users' => [
      'table'   => 'users',
    ],
    
  2. Secondly you must specify the providers to use for social login in the providers array. To active a provider set the value to true, (*16)

    'providers' => [
      'facebook'  => true,
      'google'    => true,
      'github'    => true,
    ],
    

The last configuration is to stylize the button by editing class name and add or remove icon, (*17)

, (*18)

Next, if you may want to re-publish the laravel-oauth assets, config, and the migrations run the following command:, (*19)

php artisan vendor:publish --tag=laravel-oauth.assets --force
php artisan vendor:publish --tag=laravel-oauth.config --force
php artisan vendor:publish --tag=laravel-oauth.migrations --force
  1. Next to make sure you have the latest database schema run:, (*20)

    php artisan migrate
    
  2. Inside of your master.blade.php file include a header yield. Inside the head of your master or app.blade.php add the following:, (*21)

    @yield('css')
    
  3. Add the blade directive to your view where you want to display the socials buttons. The directive takes a parameter login to display the login text or resgister for the text related to the registration, (*22)

    @socialite('login')
    
  4. Add the style of the buttons by adding this to your view in the section in the @yield('css') who defined in your master layout, (*23)

@section('css')
    <link href="{{ url('/vendor/mckenziearts/laravel-oauth/assets/css/socialite.css') }}" rel="stylesheet">
@endsection
  1. In the Auth\LoginController of your application, add the OAuthSocialite trait:, (*24)

    namespace App\Http\Controllers\Auth;
    
    use App\Http\Controllers\Controller;
    use Illuminate\Foundation\Auth\AuthenticatesUsers;
    use Mckenziearts\LaravelOAuth\Traits\OAuthSocialite;
    
    class LoginController extends Controller
    {
      use OAuthSocialite;
      ..
    

    With this feature you can overwrite the present methods on the trait if you want to customize them even more, (*25)

  2. Add this routes to your default web route file, (*26)

    Route::get('/auth/{provider}', 'Auth\LoginController@redirectToProvider');
    Route::get('/callback/{provider}', 'Auth\LoginController@handleProviderCallback');
    

Change log

Please see the changelog.md for more information on what has changed recently., (*27)

Testing

bash $ composer test, (*28)

Contributing

Please see contributing.md for details and a todolist., (*29)

Security

If you discover any security related issues, please email monneylobe@gmail.com instead of using the issue tracker., (*30)

Credits

License

MIT. Please see the license.md for more information., (*31)

The Versions

19/07 2018

dev-master

9999999-dev https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

19/07 2018

1.0.6

1.0.6.0 https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

16/07 2018

1.0.5

1.0.5.0 https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

09/07 2018

1.0.4

1.0.4.0 https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

06/07 2018

1.0.3

1.0.3.0 https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

02/07 2018

1.0.2

1.0.2.0 https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

30/06 2018

1.0.1

1.0.1.0 https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

30/06 2018

dev-analysis-8QBpyp

dev-analysis-8QBpyp https://github.com/mckenziearts/laravel-oauth

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

30/06 2018

dev-analysis-8wl0pe

dev-analysis-8wl0pe https://github.com/mckenziearts/laravel-socialite

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite

30/06 2018

v1.0

1.0.0.0 https://github.com/mckenziearts/laravel-socialite

Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel oauth laravel-socialite