tokenamazon-cognitoinsomniaawscognitotoken

Get Cognito token using Insomnia with awscognitotoken plugin


I look for the Authorization token used by Cognito in order to put it in the header of my tests. I need to test some backend API.

I am using Insomnia and the awscognitotoken plugin. However, I fail to configure it in order to get the token. Their usage is not clear to me.

Here is how I configure the awscognitotoken plugin :

What I get is:

Error in getting session: 
{ "request":
  { "method":"post",
    "headers":{
      "content-type":"application/x-amz-json-1.1",
      "x-amz-target":"AWSCognitoIdentityProviderService.InitiateAuth"
    },
    "body":"{\"AuthFlow\":\"USER_PASSWORD_AUTH\",\"ClientId\":\"3t***dcl5\",\"AuthParameters\":{\"USERNAME\":\"myemail@example.com\",\"PASSWORD\":\"<password>\"}}"},
  "status":400
}

Can you spot any error?


Solution

  • Il seems that in my case the problem was that I did not allow the USER_PASSWORD_AUTH in the settings of AWS.

    Here is what I did to allow it:

    After doing that I've got the token [and I feel stupid].