Laravel 4.x Opauth package

Installs: 1 274

Dependents: 0

Stars: 7

Watchers: 2

Forks: 4

Language: PHP

0.1.3 2014-06-13 08:48 UTC



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:



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' => '', function ($strategy, $action = 'request') {
}])->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' => '' section, again, route should be a named route, just for proper work.


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!