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 réponses
0
Réponse acceptée

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
répondu il y a un an
  • 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
INGÉNIEUR EN ASSISTANCE TECHNIQUE
Tarit_G
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions