What is the REST (or CLI) API for logging in to Amazon Cognito user pools

后端 未结 7 1883
离开以前
离开以前 2020-12-05 02:46

How do i make logins happen via Amazon Cognito REST APIs (for user pools) on platforms for which there is no official SDK? - Note that i am asking

相关标签:
7条回答
  • 2020-12-05 03:45

    This curl command works for me:

    curl -X POST --data @aws-auth-data.json \
    -H 'X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth' \
    -H 'Content-Type: application/x-amz-json-1.1' \
    https://cognito-idp.us-east-1.amazonaws.com/
    

    Where aws-auth-data.json is:

    {
       "AuthParameters" : {
          "USERNAME" : "yourusername@example.com",
          "PASSWORD" : "yourpassword"
       },
       "AuthFlow" : "USER_PASSWORD_AUTH",
       "ClientId" : "75........................"
    }
    

    The user pool client must allow USER_PASSWORD_AUTH for this to work - that's an AWS-side setting.

    0 讨论(0)
提交回复
热议问题