记 laravel dingo/api JSON Web Tokens (JWT) 更改默认 auth guard
路由定义
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
$api->group([
'as' => 'api.sys',
'prefix' => 'sys',
'namespace' => "App\\Api\\Controllers\\Sys"
], function ($api) {
//账户密码登录生成token
$api->post('authorizations', 'AuthorizationsController@store')
->name('.authorizations');
$api->group([
'middleware' => [
'auth:apiSys', #################### 本文重点 #### auth认证要写在中间件前面,中间件中才会根据指定的 guard 进行处理
'api.sys'
]
], function ($api) {
// 刷新token
$api->put('authorizations/current', 'Au