Open
Description
Q | A |
---|---|
Bug? | no |
New Feature? | no |
Framework | Laravel |
Framework version | 5.5.y |
Package version | 2.0.0-alpha2 |
PHP version | 7.1.y |
config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'TLXAdminUsers',
],
'user' => [
'driver' => 'jwt',
'provider' => 'Users',
],
'staff' => [
'driver' => 'jwt',
'provider' => 'Staff',
]
]
config/api.php
'auth' => [
'jwt' => 'Dingo\Api\Auth\Provider\JWT'
],
Kernel.php
protected $routeMiddleware = [
'api-auth' => \Dingo\Api\Http\Middleware\Auth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \Studiomate\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'role' => \Laratrust\Middleware\LaratrustRole::class,
'permission' => \Laratrust\Middleware\LaratrustPermission::class,
'ability' => \Laratrust\Middleware\LaratrustAbility::class
];
I want to use 'staff' guard and 'user' guard in 'dingo auth' with 'jwt' on the route.
However, 'dingo auth' using 'jwt' seems to be able to use only the defaults defined in config / auth.php.
Is there a way to use 'staff' guard and 'user' guard on a route?
I know how to use 'auth:staff' on middleware by defining
'auth' => Illuminate\Auth\Middleware\Authenticate::class'
on routeMiddleware, This is also a problem because of an 500 error not 401 error.