laravel Passport中撤销、删除个人令牌的示例代码

2023-06-01 00:00:00 示例 令牌 撤销

Passport基于Alex Bilbie维护的League OAuth2 server,

可以在数分钟内为Laravel应用提供完整的OAuth2服务器实现

https://github.com/thephpleague/oauth2-server


github:

https://github.com/laravel/passport

翻译中文手册:

https://learnku.com/docs/laravel/8.5/passport/10427


Passport撤销或删除个人令牌示例代码:

$tokenId = Auth::guard('api')->user()->currentAccessToken()->id;
$tokenRepository = app('Laravel\Passport\TokenRepository');
$tokenRepository->revokeAccessToken($tokenId);

相关文章