Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,44 @@ Check our docs page to get a complete guide on how to install it in an existing

> If you find something wrong in our docs, PR are welcome in our docs repo: https://github.com/auth0/docs

###Laravel 5.2

####Routes
Your routes need to be in the `web` routes group, otherwise it will not be able to use the session storage:

```
Route::group(['middleware' => ['web']], function () {

Route::get('/auth0/callback', '\Auth0\Login\Auth0Controller@callback');

Route::get('/', function () {

if (Auth::check()) dd('LOGGED IN',Auth::user());

return view('welcome');

});
});
```

####Auth setup

In your `config/auth.php` file update the providers to use the `auth0` driver:

```
...
'providers' => [
'users' => [
'driver' => 'auth0',
],
],
...
```

##Laravel Compatibility

The last version (2.x) targets Laravel 5 compatibility.
The 2.x branch targets Laravel 5.0 and 5.1 compatibility.
The 3.x branch targets Laravel 5.2 compatibility.

If you are working with an older version (Laravel 4.x) you need to point to composer.json to the version 1.0.*

Expand Down
9 changes: 9 additions & 0 deletions src/Auth0/Login/Auth0User.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ public function getAuthIdentifier() {
return $this->userInfo["user_id"];
}

/**
* Get id field name.
*
* @return string
*/
public function getAuthIdentifierName() {
return 'id';
}

/**
* Get the password for the user.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Auth0/Login/LaravelSessionStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function set($key, $value) {
Session::put($key_name, $value);
}

public function get($key, $default=false) {
public function get($key, $default=null) {
$key_name = $this->getSessionKeyName($key);

return Session::get($key_name, $default);
Expand Down
11 changes: 3 additions & 8 deletions src/Auth0/Login/LoginServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ class LoginServiceProvider extends ServiceProvider {
*/
public function boot()
{
\Auth::extend('auth0', function($app) {

// Let the container build the repository for us
$userRepository = \App::make('\Auth0\Login\Contract\Auth0UserRepository');

$provider = new Auth0UserProvider($userRepository);

return new \Illuminate\Auth\Guard($provider, $app['session.store']);

\Auth::provider('auth0', function($app, array $config) {
$userRepository = \App::make(\Auth0\Login\Contract\Auth0UserRepository::class);
return new Auth0UserProvider($userRepository);
});

$this->publishes([
Expand Down