dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

Problems on using dingo, JWT with Sentinel on Laravel 5.5 #1488

Closed chilio closed 6 years ago

chilio commented 6 years ago
Q A
Bug? no
New Feature? yes
Framework Laravel
Framework version 5.5.2
Package version 2.0.0-alpha1
PHP version 7.1.12

Actual Behaviour

Type error: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given, called in /vagrant/Code/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 379

Similar errors arise when using custom guards:

Type error: Argument 1 passed to Tymon\JWTAuth\JWTGuard::__construct() must be an instance of Tymon\JWTAuth\JWT, instance of Illuminate\Auth\EloquentUserProvider given, called in /vagrant/Code/app/Providers/AuthServiceProvider.php on line 32",

Expected Behaviour

It should pass without errors.

Steps to Reproduce

Install sentinel change User extends to Cartalyst\Sentinel\Users\EloquentUser instead of Authenticable

Possible Solutions

Overriding classes, building custom providers. All seems wrong in respect to future updates in packages...

Solutions on the web

None actually working, so far for laravel 5.5... But there are some explanations, for earlier laravel versions. Not tested though...

chilio commented 6 years ago

Managed this to work using comments here