mariovalney / laravel-keycloak-web-guard

Simple Keycloak Guard to Laravel Web Routes - https://packagist.org/packages/vizir/laravel-keycloak-web-guard
146 stars 80 forks source link

How to make it work with Eloquent? #82

Open yves-chevallier opened 2 years ago

yves-chevallier commented 2 years ago

From your README:

You can implement your own User Provider: just remember to implement the retrieveByCredentials method receiving the Keycloak Profile >information to retrieve a instance of model. Eloquent/Database User Provider should work well as they will parse the Keycloak Profile and make a "where" >to your database. So your user data must match with Keycloak Profile.

In my auth.php I have this:

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\Models\User::class,
    ],

It doesn't work because the error [Keycloak Error] User cannot be authenticated.

It works with the keycloak-users driver, but my database isn't populated.

What should I change to make it work with eloquent?