Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cognito USER_PASSWORD_AUTH "Initiate Auth method not supported."

I am trying to do the following:

  AWSUtil.generateSecretHash('[email protected]', ClientId).then(SECRET_HASH => {
    return AWSUtil.Cognito.adminInitiateAuth({
      AuthFlow: 'USER_PASSWORD_AUTH',
      ClientId,
      UserPoolId: process.env.COGNITO_USER_POOL_ID,
      AuthParameters: {
        USERNAME: '[email protected]',
        PASSWORD: 'lamepassword123',
        SECRET_HASH
      }
    }).promise();
  })
  .then(resp => {
    console.log(resp)
  });

It will not return anything but "Initiate Auth method not supported."

According to the docs, this should work. What gives?

like image 516
Drakken Saer Avatar asked Feb 13 '18 00:02

Drakken Saer


2 Answers

I had the same issue - resolved it by using AuthFlow ADMIN_NO_SRP_AUTH rather than USER_PASSWORD_AUTH per the example here.

like image 77
James Billinger Avatar answered Oct 24 '22 03:10

James Billinger


Under the App Clients section, did you enable the box for your user pool that says:

[x] Enable username-password (non-SRP) flow for app-based authentication (USER_PASSWORD_AUTH)
like image 37
Ionut Trestian Avatar answered Oct 24 '22 05:10

Ionut Trestian