Skip to content

Commit 2dc7fa5

Browse files
Check token expiry in bearer auth
1 parent 1b8e94c commit 2dc7fa5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server/auth/middleware/bearerAuth.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export function requireBearerAuth({ provider, requiredScopes = [] }: BearerAuthM
5555
}
5656
}
5757

58+
// Check if the token is expired
59+
if (!!authInfo.expiresAt && authInfo.expiresAt < Date.now() / 1000) {
60+
throw new InvalidTokenError("Token has expired");
61+
}
62+
5863
req.auth = authInfo;
5964
next();
6065
} catch (error) {

0 commit comments

Comments
 (0)