Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cognito IntitiateAuth: Missing required parameter UserName

When initializing an authentication to AWS Cognito, the API is rejecting my request:

InvalidParameterException: Missing required parameter UserName
status code: 400,

Here is the content of the request (yes, I tried putting it everywhere, no success).

params := &cognitoidentityprovider.InitiateAuthInput{
    AuthFlow: aws.String("USER_SRP_AUTH"),              // Required
    ClientId: aws.String("xxxxxxxxxxxxxxxx"), // Required
    AuthParameters: map[string]*string{
        "username":     aws.String("myUser"), // Required
        "UserName":     aws.String("myUser"), // Required
    },
    ClientMetadata: map[string]*string{
        "username":     aws.String("myUser"), // Required
        "UserName":     aws.String("myUser"), // Required
    },
}

Any idea about what would be the problem please? Considering to the doc (https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-dg-pdf.pdf), username should be in AuthParameters along with srpA. Would it be possible that the problem comes from srpA? If so, what is this? It looks like that it is the password.

like image 949
Arkon Avatar asked Aug 01 '16 01:08

Arkon


1 Answers

It should be in AuthParameters, not ClientMetadata.

I believe the expected values are USERNAME and SRP_A.

like image 84
Jeff Bailey Avatar answered Nov 11 '22 18:11

Jeff Bailey