JWT regex for a specific aud


When configuring a Cognito Authorizer in API Gateway, a tooltip suggests providing a regex that will pre-validate the audience (aud).

I'm not clear on what the payload will be, so I'm not sure how to write this regex. Is there a sample regex available?

See this link for a screenshot: https://stackoverflow.com/questions/71014006/jwt-regex-for-a-specific-aud

2 Answers
Accepted Answer

The tooltip actually talks about validating the token, i.e., the header, before sending it to Cognito. I do not think it makes a lot of sense to use it for a Cognito authorizer. It makes more sense when using a Lambda authorizer to make sure that the header contains the value in the right format. This will save you cost in the cases the format is invalid and then API Gateway will not invoke the function.

profile pictureAWS
answered 2 years ago

sorry I wasn't able to help, removing my answer

profile picture
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions