socialism/laravel-opauth

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

Laravel 4.x Opauth package

0.1.3 2014-06-13 08:48 UTC

This package is not auto-updated.

Last update: 2018-10-08 13:47:26 UTC


README

Installation:

Add to your composer.json in require section following line:

"socialism/laravel-opauth": "0.1.*"

And run composer update, after that add the following line at the and of app/config/app.php providers section:

'Socialism\LaravelOpauth\LaravelOpauthServiceProvider',

Usage:

First of all define some route in your app/routes.php it should be a named route, like this:

Route::any('auth/social/{strategy}/{action?}', ['as' => 'auth.social', function ($strategy, $action = 'request') {
    app('opauth')->run();
}])->where(['strategy' => '.*']);

Yes, route pattern must end up with {strategy/{action?}, well, actually, strategy and action parameters can be named as you wish, but the whole idea is that real URI MUST end up with something like that facebook/callback or twitter. And yes, action parameter SHOULD be optional, if not your URI's MUST end up like this google/request.

Note this 'as' => 'auth.social' section, again, route should be a named route, just for proper work.

Configuration

Publish package config:

php artisan config:publish socialism/laravel-opauth

So now you can configure route to be used and strategies in app/config/packages/socialism/laravel-opauth/config.php.

route key is about what URL actually accepts requests for opauth, it was noted in Usage section. opauth key is all about standard configuration described on official page, except this keys:

  • security_salt will be setted automatically from app.key config.
  • path will also be generated automatically, actually for this config option package needs named route with such restrictions.

Adding more strategies:

You are able to add any of the strategies which is all here: List-of-strategies

Warning! Package will not work until you add at least one strategy to configuration file!