fix(oauth): log agent assertion verification failures

This commit is contained in:
saltbo
2026-08-02 15:43:01 -04:00
parent bc4a71f691
commit fa158cb11e
+5 -1
View File
@@ -256,7 +256,11 @@ async function verifyAgentAssertion(
let verified: Awaited<ReturnType<typeof jwtVerify>>
try {
verified = await jwtVerify(assertion, jwks, { audience: endpoint, maxTokenAge: '5m' })
} catch {
} catch (error) {
console.warn('Agent assertion verification failed', {
code: error instanceof Error && 'code' in error ? error.code : undefined,
message: error instanceof Error ? error.message : String(error),
})
throw oauthError('invalid_grant', 'Agent assertion is invalid')
}
const issuer = requiredClaim(verified.payload.iss, 'assertion iss')