Check token expiry in bearer auth

This commit is contained in:
Jerome 2025-02-23 10:57:26 +00:00
commit 2dc7fa5df8
No known key found for this signature in database

View file

@ -55,6 +55,11 @@ export function requireBearerAuth({ provider, requiredScopes = [] }: BearerAuthM
}
}
// Check if the token is expired
if (!!authInfo.expiresAt && authInfo.expiresAt < Date.now() / 1000) {
throw new InvalidTokenError("Token has expired");
}
req.auth = authInfo;
next();
} catch (error) {