5

In the AWS Cognito docs, http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#initiateAuth-property

One of the supported Authentication flow is USER_SRP_AUTH. When I call the initiateAuth(), I get

InvalidParameterException: Missing required parameter SRP_A error.

The doc is silent about how to get/generate this SRP_A that the method requires. Where can I find how to use this auth flow?

Thanks in advance!

Ariel Araza
  • 431
  • 4
  • 5

2 Answers2

1

Please refer to this answer: AWS Cognito user authentication Missing required parameter SRP_A

In short, SRP_A is just a large integer value.

If you are doing client-side auth, then you can continue on this path, or if you are in a web application you could just to OAuth with any other library.

If you are doing auth server-side you should instead use admin-initiate-auth in which case you no longer will be using SRP and you don't need to deal with computing the challenge response and so forth.

dutzu
  • 3,883
  • 13
  • 19
-1

I had similar problem with the "AdminInitiateAuth" method. I was able to get mine working by enabling ADMIN_NO_SRP_AUTH in the UserPool. Go to UserPool > APPS > Show Details and check the checkbox "Enable sign-in API for server-based authentication (ADMIN_NO_SRP_AUTH)". Once that was done, I could use the AuthFlowType.ADMIN_NO_SRP_AUTH.

// example from a java implementation... 
AdminInitiateAuthRequest request = new AdminInitiateAuthRequest();
request.withClientId(CLIENT_APP_ID); // clinet id assigned in the userpool
request.withUserPoolId(USER_POOL_ID); // the id of the user pool 
request.addAuthParametersEntry("USERNAME", userId);
request.addAuthParametersEntry("PASSWORD", pwd);
request.withAuthFlow(AuthFlowType.ADMIN_NO_SRP_AUTH); 
// HAVE TO ENABLE THIS WORKFLOW ON THE USER POOL!
// You may be able to just set the workflow to AuthFlowType.USER_SRP_AUTH if you don't use the AdminInitiateRequest

// initiate the auth request
AdminInitiateAuthResult result = identityUserPoolProviderClient.adminInitiateAuth(request);
Matt
  • 363
  • 3
  • 11