AWS Cognito TOKEN Endpoint giving a 400 Bad Request error “unauthorized_client”

Question:

Following the documentation from https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html after successfully retrieving an authentication code.

As far as I can tell this is exactly how the request is supposed to be setup:

Why would be getting unauthorized_client? Is there an easier way to debug this?

Edit: tested this in Postman with the same request and getting the same error

Headers
Header
Body
Body

Answer:

Please check if the Cognito User Pool App is using secret key. If you have created with secret key option, that must be included in the Authorization header of the request.

Leave a Reply