我正在尝试管理acces令牌
当客户呼叫路由oauth / token时,他使用以下代码获取新令牌
public function login(Request $request)
{
$this->validate($request, [
'identifiant' => 'required',
'motDePasse' => 'required'
]);
Log::info('WS_API __ Authentification : ' . json_encode($request->all()));
$params = [
'grant_type' => 'password',
'client_id' => $this->client->id,
'client_secret' => $this->client->secret,
'username' => request('identifiant'),
'password' => request('motDePasse'),
'scope' => '*'
];
$request->request->add($params);
$proxy = Request::create('oauth/token', 'POST');
$dispatch = Route::dispatch($proxy);
if ($dispatch->getStatusCode() == '200') {
Log::info('WS_API __ Authentification : ' . json_encode($request->all()) . ' with STATUS : ' . $dispatch->getStatusCode());
$content = json_decode($dispatch->getContent());
return response()->json([
'token' => $content->access_token
]);
}
return Route::dispatch($proxy);
}
我如何管理令牌?撤消现有令牌或将其删除