Unable to get token using Cognito for client credentials flow

0

I want to use Cognito for server to server authentication via client credentials. I created and configured a user pool and a client app. with client id and secrets. When I use postman to post to https://{myapp}.auth.us-west-2.amazoncognito.com/oauth2/token, I always get 405 error. I followed some examples online, but they don't seem to work.

2 Answers
0
Accepted Answer

Hi,

Both the POST method and /oauth2/token path seem correct. Could you check that you are sending the Content-Type header with application/x-www-form-urlencoded as value? According to AWS documentation, this header is mandatory and must contain the indicated value.

profile picture
EXPERT
answered a year ago
  • Thank you, I finally got it working after adding content-type to the header as you suggested.

0

You must make a POST request to the /token endpoint of your Cognito user pool. Please refer to the steps mentioned under "Client credentials grant" section of this article.

AWS
SUPPORT ENGINEER
Tarit_G
answered a year 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