perf: openapi token有效期配置

This commit is contained in:
2025-07-15 14:45:16 +08:00
parent 9e22cde6ba
commit 6eac1e5d7b
3 changed files with 10 additions and 2 deletions

View File

@@ -19,7 +19,10 @@ class Auth
public function handle($request, \Closure $next)
{
try {
$oauth = new OAuth2(new OAuthStorage);
$oauth = new OAuth2(new OAuthStorage, [
'access_token_lifetime' => env('OPENAPI.ACCESS_TOKEN_LIFETIME', 3600),
'refresh_token_lifetime' => env('OPENAPI.REFRESH_TOKEN_LIFETIME', 1209600),
]);
$token = $oauth->getBearerToken();
$oauth->verifyAccessToken($token);
} catch (OAuth2ServerException $e) {