Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created February 21, 2019 03:08
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save miguelmota/8b519212aca47210d529532b3d8e5b2f to your computer and use it in GitHub Desktop.
Save miguelmota/8b519212aca47210d529532b3d8e5b2f to your computer and use it in GitHub Desktop.
AWS Cognito Identity authenticate using cURL
{
"AuthParameters" : {
"USERNAME" : "alice@example.com",
"PASSWORD" : "mysecret"
},
"AuthFlow" : "USER_PASSWORD_AUTH",
"ClientId" : "9..............."
}
curl -X POST --data @auth.json \
-H 'X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth' \
-H 'Content-Type: application/x-amz-json-1.1' \
https://cognito-idp.us-east-1.amazonaws.com/
Dashboard -> "App Clients" -> "Show Details" -> check "Enable username-password (non-SRP) flow for app-based authentication (USER_PASSWORD_AUTH)"
@mauriciovilela
Copy link

mauriciovilela commented Mar 22, 2020

very good, it worked

@LorhanSohaky
Copy link

Can I use this when I have a Federation (Open Id)?

@hackmajoris
Copy link

hackmajoris commented Oct 14, 2022

@LorhanSohaky It works with Open Id, but you'll miss the scopes in the returned token.

@RogerWebb
Copy link

Thank you. Works as advertised. Saved me some time tonight.

@pvlshev
Copy link

pvlshev commented Mar 4, 2023

This is just brilliant! Thanks a lot! I've already spent a few hours on research and debugging session!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment