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.

已提問 1 年前檢視次數 1621 次
2 個答案
0
已接受的答案

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
專家
已回答 1 年前
  • 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
支援工程師
Tarit_G
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南