Skip to content

Commit

Permalink
fix: add error message
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Nov 7, 2024
1 parent 74ff4a8 commit 4f01878
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/oauth2/src/resource-request/verify-resource-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ export async function verifyResourceRequest(options: VerifyResourceRequestOption
if (error instanceof JsonParseError || error instanceof ValidationError) return null

const errorMessage = error instanceof Oauth2Error ? error.message : 'Invalid access token'
throw new Oauth2ResourceUnauthorizedError('Error occured during verification of jwt profile access token', {
scheme: SupportedAuthenticationScheme.Bearer,
error: Oauth2ErrorCodes.InvalidToken,
error_description: errorMessage,
})
throw new Oauth2ResourceUnauthorizedError(
`Error occured during verification of jwt profile access token: ${error.message}`,
{
scheme: SupportedAuthenticationScheme.Bearer,
error: Oauth2ErrorCodes.InvalidToken,
error_description: errorMessage,
}
)
})

let tokenPayload: AccessTokenProfileJwtPayload | TokenIntrospectionResponse | undefined = verificationResult?.payload
Expand Down

0 comments on commit 4f01878

Please sign in to comment.