changyy/laravel-oauth-library

Simple Facebook/Google OAuth Library for Laravel framework
20
Install
composer require changyy/laravel-oauth-library
Latest Version:1.0
License:MIT
Last Updated:May 20, 2017
Links: GitHub  ·  Packagist
Maintainer: changyy

laravel-oauth-library

An Simple Facebook/Google OAuth Client for Laravel Framework

Laravel Usage

$ php composer.phar require changyy/laravel-oauth-library
$ php artisan make:controller OAuthConnect
$ vim app/Http/Controllers/OAuthConnect.php
namespace App\Http\Controllers;

use Illuminate\Http\Request;

class OAuthConnect extends \org\changyy\OAuth\Controller\Connect
{
    public function handleFacebookConnected($oauth_ret = []) {
        print_r($oauth_ret);
    }
    public function initFacebook() {
        if(!session_id())
            session_start();
        parent::initFacebook();
    }
    public function handleGoogleConnected($oauth_ret = []) {
        print_r($oauth_ret);
    }
}

$ vim routes/web.php
Route::get('/connect/facebook', 'OAuthConnect@connectFacebook');
Route::get('/connect/google', 'OAuthConnect@connectGoogle');

$ vim config/oauth.php
return [
    'methods' => [
        'facebook' => [
            'tag' => 'facebook',
            'default_graph_version' => 'v2.9',
            'app_id' => 'xxxxx',
            'secret_key' => 'xxxxxx',
            'scope' => [ 'email' ],
            'done_handler' => '/',
            'error_handler' => '/connect/error',
        ],  
        'google' => [
            'tag' => 'google',
            'client_id' => 'xxxxx',
            'client_secret' => 'xxxxx',
            'scope' => [ 'email', 'profile' ],
            'done_handler' => '/',
            'error_handler' => '/connect/error',
        ],
];

Related Packages

cresjie/social-login

Laravel authentication with Social Services API

55 5
vocolboy/socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.

114 0
cerbero/oauth

OAuth and API helpers for Laravel 4.

411
arcanedev/socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.

14 2
thomaswelton/laravel-oauth

Laravel package for the simplification and integration of many of your users mos...

961 41