Skip to content

Commit e90b4d4

Browse files
committed
chore: only cache oauth tokens
1 parent a0ace65 commit e90b4d4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/backend/src/tokens/request.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,9 @@ export const authenticateRequest: AuthenticateRequest = (async (
812812

813813
const { data, tokenType, errors } = await verifyMachineAuthToken(tokenInHeader, authenticateContext);
814814
if (errors) {
815-
maybeCacheOAuthTokenAsInvalid(errors[0], tokenInHeader);
815+
if (isOAuthTokenByPrefix(tokenInHeader)) {
816+
maybeCacheOAuthTokenAsInvalid(errors[0], tokenInHeader);
817+
}
816818
return handleMachineError(tokenType, errors[0]);
817819
}
818820
return signedIn({
@@ -844,7 +846,9 @@ export const authenticateRequest: AuthenticateRequest = (async (
844846

845847
const { data, tokenType, errors } = await verifyMachineAuthToken(tokenInHeader, authenticateContext);
846848
if (errors) {
847-
maybeCacheOAuthTokenAsInvalid(errors[0], tokenInHeader);
849+
if (isOAuthTokenByPrefix(tokenInHeader)) {
850+
maybeCacheOAuthTokenAsInvalid(errors[0], tokenInHeader);
851+
}
848852
return handleMachineError(tokenType, errors[0]);
849853
}
850854

0 commit comments

Comments
 (0)