2017 © Pedro Peláez
 

library laravel-socialite

Social OAuth authentication for Laravel 5.

image

lightmagic/laravel-socialite

Social OAuth authentication for Laravel 5.

  • Monday, March 20, 2017
  • by BrettCao
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel-socialite

Installation

$ composer require "overtrue/laravel-socialite:~1.0"

if you have been installed the overtrue/socialite package, please remove it from composer.json before this command., (*1)

Configuration

  1. After installing the Socialite library, register the Overtrue\LaravelSocialite\ServiceProvider in your config/app.php configuration file:, (*2)

    'providers' => [
      // Other service providers...
      Overtrue\LaravelSocialite\ServiceProvider::class,
    ],
    
  2. Add the follow line to the aliases section of config/app.php:, (*3)

    'Socialite' => Overtrue\LaravelSocialite\Socialite::class,
    
  3. You will also need to add credentials for the OAuth services your application utilizes. These credentials should be placed in your config/socialite.php or config/services.php configuration file, and should use the key facebook, twitter, linkedin, google, github or bitbucket, depending on the providers your application requires. For example:, (*4)

    <?php
    
    return [
     //...
     'github' => [
         'client_id'     => 'your-app-id',
         'client_secret' => 'your-app-secret',
         'redirect'      => 'http://localhost/socialite/callback.php',
     ],
     //...
    ];
    

Usage

<?php

namespace App\Http\Controllers;

use Socialite;
use Illuminate\Routing\Controller;

class AuthController extends Controller
{
    /**
     * Redirect the user to the GitHub authentication page.
     *
     * @return Response
     */
    public function redirectToProvider()
    {
        return Socialite::driver('github')->redirect();
    }

    /**
     * Obtain the user information from GitHub.
     *
     * @return Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('github')->user();

        // $user->token;
    }
}

And register routes:, (*5)

Route::get('/oauth/github', 'AuthController@redirectToProvider');
Route::get('/oauth/github/callback', 'AuthController@handleProviderCallback');

About more usage, please refer to overtrue/socialite., (*6)

License

MIT, (*7)

The Versions

20/03 2017

dev-master

9999999-dev

Social OAuth authentication for Laravel 5.

  Sources   Download

MIT

The Requires

 

by lightmagic

20/03 2017

1.0.3

1.0.3.0

Social OAuth authentication for Laravel 5.

  Sources   Download

MIT

The Requires

 

by lightmagic

29/01 2017

1.0.2

1.0.2.0

Social OAuth authentication for Laravel 5.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

10/03 2016

1.0.1

1.0.1.0

Social OAuth authentication for Laravel 5.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue

13/12 2015

1.0.0

1.0.0.0

Social OAuth authentication for Laravel 5.

  Sources   Download

MIT

The Requires

 

by Avatar overtrue