<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Michelle Austria</title>
    <description>The latest articles on Forem by Michelle Austria (@michaustriaqa).</description>
    <link>https://forem.com/michaustriaqa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1718275%2F986b83df-72b3-4ac2-be06-0d31236892b3.png</url>
      <title>Forem: Michelle Austria</title>
      <link>https://forem.com/michaustriaqa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/michaustriaqa"/>
    <language>en</language>
    <item>
      <title>How to Simulate AWS Cognito Login in Postman</title>
      <dc:creator>Michelle Austria</dc:creator>
      <pubDate>Wed, 11 Mar 2026 11:33:16 +0000</pubDate>
      <link>https://forem.com/michaustriaqa/how-to-simulate-cognito-login-in-postman-5fog</link>
      <guid>https://forem.com/michaustriaqa/how-to-simulate-cognito-login-in-postman-5fog</guid>
      <description>&lt;p&gt;When you're testing a backend system protected by AWS Cognito, one of the first practical challenges is getting a valid auth token without going through the frontend app. You need to call the Cognito identity provider directly — and that means setting up your Postman request correctly from the start.&lt;/p&gt;

&lt;p&gt;This post walks through the exact setup, from IAM credentials to a working &lt;code&gt;200 OK&lt;/code&gt; with an &lt;code&gt;AccessToken&lt;/code&gt; in hand.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you start, make sure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to the AWS Console with permissions to view Cognito and IAM&lt;/li&gt;
&lt;li&gt;The AWS region where your Cognito User Pool is deployed (e.g., &lt;code&gt;us-east-2&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;An IAM user with programmatic access — you will need the Access Key ID and Secret Access Key&lt;/li&gt;
&lt;li&gt;Your Cognito App Client ID, found under User Pool &amp;gt; App clients&lt;/li&gt;
&lt;li&gt;A test user account in the User Pool with known credentials&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;USER_PASSWORD_AUTH&lt;/code&gt; enabled on the App Client (covered below)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  A Note on USER_PASSWORD_AUTH
&lt;/h2&gt;

&lt;p&gt;Cognito supports multiple authentication flows. The &lt;code&gt;USER_PASSWORD_AUTH&lt;/code&gt; flow accepts a username and password directly in the request body, which is exactly what you need for direct API testing via Postman.&lt;/p&gt;

&lt;p&gt;The default flow, &lt;code&gt;USER_SRP_AUTH&lt;/code&gt;, uses a challenge-response mechanism that is harder to replicate manually. &lt;code&gt;USER_PASSWORD_AUTH&lt;/code&gt; skips that and authenticates in a single call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Only enable this on your development and staging environments. Do not enable it in production.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To verify or enable it in the AWS Console:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Cognito &amp;gt; User Pools &amp;gt; [Your Pool] &amp;gt; App clients&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select your client and open the &lt;strong&gt;Authentication flows&lt;/strong&gt; section&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;ALLOW_USER_PASSWORD_AUTH&lt;/code&gt; if it is not already checked&lt;/li&gt;
&lt;li&gt;Save the changes&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 1: Get Your IAM Credentials
&lt;/h2&gt;

&lt;p&gt;The Cognito IDP endpoint requires your requests to be signed with valid AWS credentials. Postman handles the signing automatically once you provide your keys — you just need to supply them.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM &amp;gt; Users &amp;gt; [Your User] &amp;gt; Security credentials&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Access keys&lt;/strong&gt;, create or retrieve your &lt;strong&gt;Access Key ID&lt;/strong&gt; and &lt;strong&gt;Secret Access Key&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Store these in Postman Vault rather than pasting them directly into environment variables that sync to the Postman cloud (covered in the next step)&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 2: Store Credentials in Postman Vault
&lt;/h2&gt;

&lt;p&gt;Postman Vault stores sensitive values locally on your machine and does not sync them to Postman's servers. It is the right place for credentials you do not want shared across a team or exposed in collection exports.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Vault&lt;/strong&gt; from the bottom toolbar in Postman&lt;/li&gt;
&lt;li&gt;Add two entries:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;access_key&lt;/code&gt; → your Access Key ID&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;secret_key&lt;/code&gt; → your Secret Access Key&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Reference them in your requests as &lt;code&gt;{{vault:access_key}}&lt;/code&gt; and &lt;code&gt;{{vault:secret_key}}&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 3: Configure the Authorization Tab
&lt;/h2&gt;

&lt;p&gt;Create a new POST request targeting the Cognito IDP endpoint for your region:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST https://cognito-idp.us-east-2.amazonaws.com/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to the &lt;strong&gt;Authorization&lt;/strong&gt; tab and fill in the following. Postman will use these details to sign the request before it is sent — you do not need to construct the signature manually.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Auth Type&lt;/td&gt;
&lt;td&gt;AWS Signature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Add auth to&lt;/td&gt;
&lt;td&gt;Request Headers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AccessKey&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{{vault:access_key}}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SecretKey&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{{vault:secret_key}}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Region&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;us-east-2&lt;/code&gt; (match your region)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service Name&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cognito-idp&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Session Token&lt;/td&gt;
&lt;td&gt;leave blank&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Step 4: Add the Required Headers
&lt;/h2&gt;

&lt;p&gt;Navigate to the &lt;strong&gt;Headers&lt;/strong&gt; tab and add the following:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Content-Type&lt;/td&gt;
&lt;td&gt;&lt;code&gt;application/x-amz-json-1.1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;X-Amz-Target&lt;/td&gt;
&lt;td&gt;&lt;code&gt;AWSCognitoIdentityProviderService.InitiateAuth&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;X-Amz-User-Agent&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aws-amplify/5.0.4 auth framework/5&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;X-Amz-Target&lt;/code&gt; tells the Cognito endpoint which operation you are calling. Without it, the request will fail with a &lt;code&gt;400&lt;/code&gt; error.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Build the Request Body
&lt;/h2&gt;

&lt;p&gt;Switch to the &lt;strong&gt;Body&lt;/strong&gt; tab, select &lt;strong&gt;raw&lt;/strong&gt;, and set the format to &lt;strong&gt;JSON&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"AuthFlow"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"USER_PASSWORD_AUTH"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ClientId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your_app_client_id_here"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"AuthParameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"USERNAME"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"testuser@yourdomain.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PASSWORD"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"YourTestPassword"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;ClientId&lt;/code&gt; with the App Client ID from your Cognito User Pool and supply valid credentials for a test user in that pool.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6: Send the Request
&lt;/h2&gt;

&lt;p&gt;Click &lt;strong&gt;Send&lt;/strong&gt;. A successful response will return &lt;code&gt;200 OK&lt;/code&gt; with an &lt;code&gt;AuthenticationResult&lt;/code&gt; object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"AuthenticationResult"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"AccessToken"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eyJraW..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ExpiresIn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"IdToken"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eyJraW..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"RefreshToken"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eyJjb..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"TokenType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bearer"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ChallengeParameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The token you need for downstream API calls is either the &lt;code&gt;AccessToken&lt;/code&gt; or &lt;code&gt;IdToken&lt;/code&gt;, depending on how your backend validates tokens. Use it as a &lt;code&gt;Bearer&lt;/code&gt; token in the &lt;code&gt;Authorization&lt;/code&gt; header of your next requests.&lt;/p&gt;

&lt;p&gt;If you want to inspect the token claims — for example, checking user groups or custom attributes — paste it into &lt;a href="https://jwt.io" rel="noopener noreferrer"&gt;jwt.io&lt;/a&gt; to decode the payload locally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Mistakes and Troubleshooting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;UnrecognizedClientException&lt;/code&gt; or &lt;code&gt;InvalidSignatureException&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
IAM credentials are wrong or expired, or the &lt;code&gt;AWS Region&lt;/code&gt; / &lt;code&gt;Service Name&lt;/code&gt; in the Authorization tab does not match the endpoint. Confirm that &lt;code&gt;Service Name&lt;/code&gt; is exactly &lt;code&gt;cognito-idp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;InvalidParameterException: USER_PASSWORD_AUTH flow not enabled&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
The App Client does not have that flow enabled. Go back to Cognito App Client settings and add it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;NotAuthorizedException: Incorrect username or password&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
Wrong credentials, or the user does not exist in the pool. Check under Cognito &amp;gt; Users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;400 Bad Request&lt;/code&gt; with no body&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;X-Amz-Target&lt;/code&gt; header is missing or incorrect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;MissingAuthenticationTokenException&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
The Authorization tab is not configured or the Vault values are not resolving. Red-highlighted vault references in Postman indicate an unresolved secret.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;UserNotConfirmedException&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
The test user has not been confirmed. Confirm the account via the AWS Console under Cognito &amp;gt; Users &amp;gt; [User] &amp;gt; Confirm.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Validates as a QA Engineer
&lt;/h2&gt;

&lt;p&gt;Testing the Cognito auth endpoint directly gives you more than just a token. It confirms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The App Client ID is correct and the auth flow is properly configured&lt;/li&gt;
&lt;li&gt;The test user account is confirmed and active&lt;/li&gt;
&lt;li&gt;Token expiry (&lt;code&gt;ExpiresIn: 3600&lt;/code&gt;) aligns with your session management expectations&lt;/li&gt;
&lt;li&gt;The response structure matches what your frontend or API consumer expects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once this works manually in Postman, the same &lt;code&gt;InitiateAuth&lt;/code&gt; call can be automated in JMeter using an HTTP Sampler, with the &lt;code&gt;AccessToken&lt;/code&gt; extracted via JSON Extractor and passed into subsequent requests as a variable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Enable &lt;code&gt;USER_PASSWORD_AUTH&lt;/code&gt; on the Cognito App Client (dev/staging only)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Retrieve IAM Access Key and Secret Key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Store credentials in Postman Vault&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Set Auth Type to AWS Signature in the Authorization tab&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Add &lt;code&gt;Content-Type&lt;/code&gt;, &lt;code&gt;X-Amz-Target&lt;/code&gt;, and &lt;code&gt;X-Amz-User-Agent&lt;/code&gt; headers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Build the JSON body with &lt;code&gt;AuthFlow&lt;/code&gt;, &lt;code&gt;ClientId&lt;/code&gt;, and &lt;code&gt;AuthParameters&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Send and extract the token from &lt;code&gt;AuthenticationResult&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>postman</category>
      <category>api</category>
      <category>testing</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
