Laravel 5 管理令牌laravel passport
我正在尝试管理acces令牌 当客户端调用route oauth/token时,他使用下面的代码获得新的tokenLaravel 5 管理令牌laravel passport,laravel-5,laravel-passport,Laravel 5,Laravel Passport,我正在尝试管理acces令牌 当客户端调用route oauth/token时,他使用下面的代码获得新的token public function login(Request $request) { $this->validate($request, [ 'identifiant' => 'required', 'motDePasse' => 'required' ]); Log::info('WS_API __ Au
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);
}
如何管理代币?通过撤销现有令牌或删除它们