lundi 1 août 2016

Laravel default guard api - use web guard for login route

how to change the guard for a special route?

i've configured the api guard as default

  'defaults' => [
        'guard' => 'api',
        'passwords' => 'users',
    ],

now i've a route /login to authenticate the user with basic.once and send back the api token

Route::get('/login', ['middleware' => 'auth.basic.once', 'uses' => 'ApiController@login']);

with the following error

ErrorException in AuthManager.php line 288:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Auth\TokenGuard' does not have a method 'onceBasic'

as he try to use the default api guard...

i want to keep api as default guard, just want to use web/auth.basic.once for the single /login route

thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire