orchestra/oneauth

This package is abandoned and no longer maintained. No replacement package was suggested.

Social Authentication Extension for Orchestra Platform

v3.1.0-BETA2 2015-06-18 11:04 UTC

This package is auto-updated.

Last update: 2020-02-13 04:03:24 UTC


README

Social Authentication Extension for Orchestra Platform

Latest Stable Version Total Downloads MIT License Build Status Scrutinizer Quality Score

Table of Content

Version Compatibility

Laravel OneAuth
5.0.x 3.0.x
5.1.x 3.1.x@dev
5.2.x 3.2.x@dev

Installation

To install through composer, simply put the following in your composer.json file:

{
	"require": {
		"orchestra/oneauth": "~3.0"
	}
}

And then run composer install to fetch the package.

Quick Installation

You could also simplify the above code by using the following command:

composer require "orchestra/oneauth=~3.0"

Usage

In app/Http/routes.php:

<?php

Route::get('social/{provider}/connect', [
    'uses'  => 'Auth\SocialController@connect'
])->where('{provider}', '(.+)');

In app/Http/Controllers/Auth/SocialController.php:

<?php namespace App\Http\Controllers\Auth;

use Illuminate\Http\Request;
use Illuminate\Contracts\Auth\Guard;
use App\Http\Controllers\Controller;
use Orchestra\OneAuth\Contracts\Listener\ConnectUser;
use Orchestra\OneAuth\Processor\AuthenticateUser as Processor;

class SocialController extends Controller implements ConnectUser
{
    /**
     * Connect with social provider.
     *
     * @param  \Orchestra\OneAuth\Processor\AuthenticateUser  $processor
     * @param  \Illuminate\Http\Request  $request
     * @param  string  $provider
     * @return mixed
     */
    public function connect(Processor $processor, Request $request, $provider = 'facebook')
    {
        return $processor->execute($this, $provider, $request->has('code'));
    }

    /**
     * Response when user has connected.
     *
     * @param  array  $data
     * @param  \Illuminate\Contracts\Auth\Guard  $auth
     * @return mixed
     */
    public function userHasConnected(array $data, Guard $auth)
    {
        return redirect(handles('app::/'));
    }
}