Laravel Passport 返回格式修改
{
"token_type": "Bearer",
"expires_in": 864000,
"access_token": "abc",
"refresh_token": "xxx"
}
现在laravel Passport默认返回格式是这样的,
我想修改为
{
"code": 200,
"message": '成功',
"data":{
"token_type": "Bearer",
"expires_in": 864000,
"access_token": "abc",
"refresh_token": "xxx"
}
}
想请问各位怎么样修改呢?
关于 LearnKu
博客:从零开始搭建一个 demo 项目 可以参考这篇文章
$response = $http->post(config('app.url').'/oauth/token', [ 'form_params' => [ 'grant_type' => 'password', 'client_id' => $password_client->id, 'client_secret' => $password_client->secret, 'username' => $credentials['name'], 'password' => $credentials['password'], 'scope' => '', ], ]);