AWS - Cognito Authentication - Curl Call - Generate Token Without CLI - No Client Secret

前端 未结 2 622
灰色年华
灰色年华 2021-01-06 09:35

I have created a API Gateway and I have applied Cognito Authentication there. Here to have the API Call work I am using AWS CLI to get Token , Here is my CLI Code

         


        
2条回答
  •  长发绾君心
    2021-01-06 09:56

    Just sharing direct curl here may helpful to anyone

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

    file json user-data.json

    {"AuthParameters" : {"USERNAME" : "sadfsf", "PASSWORD" : "password"}, "AuthFlow" : "USER_PASSWORD_AUTH", "ClientId" : "csdfhripnv7sq027kktf75"}
    

    make sure your app client does not contain app-secret or create new app without secret. also inside app enable USER_PASSWORD_AUTH

提交回复
热议问题