AWS Cognito Authentication USER_PASSWORD_AUTH flow not enabled for this client : <p>I have an mobile app with user pool (username &amp; password). The app works fine with aws-amplify sdk. But, wanted to move the code out to Lambdas. So, I have written the following Lambda using Boto3.</p>

<p>Here is Lambda:</p>

<pre><code>import boto3

def lambda_handler(event, context):
    client = boto3.client('cognito-idp')
    response = client.initiate_auth(
        ClientId='xxxxxxxxxxxxxx',
        AuthFlow='USER_PASSWORD_AUTH',
        AuthParameters={
            'USERNAME': 'xxxxxx',
            'PASSWORD': 'xxxxxx'
        }
    )
    return response
</code></pre>

<p>Tried admin_initiate_auth too. </p>

<pre><code>import boto3
def lambda_handler(event, context):
    client = boto3.client('cognito-idp')
    response = client.initiate_auth(
        UserPoolId='xxxxxxxxx',
        ClientId='xxxxxxxxxxxxxx',
        AuthFlow='USER_PASSWORD_AUTH',
        AuthParameters={
            'USERNAME': 'xxxxxx',
            'PASSWORD': 'xxxxxx'
        }
    )
    return response
</code></pre>

<p>Here is the error the I get.</p>

<blockquote>
  <p>An error occurred (InvalidParameterException) when calling the
  InitiateAuth operation: USER_PASSWORD_AUTH flow not enabled for this
  client: InvalidParameterException Traceback (most recent call last):<br>
  File "/var/task/lambda_function.py", line 12, in lambda_handler
      'PASSWORD': 'xxxxx'   File "/var/runtime/botocore/client.py", line 317, in _api_call
      return self._make_api_call(operation_name, kwargs)   File "/var/runtime/botocore/client.py", line 615, in _make_api_call
      raise error_class(parsed_response, operation_name) InvalidParameterException: An error occurred
  (InvalidParameterException) when calling the InitiateAuth operation:
  USER_PASSWORD_AUTH flow not enabled for this client</p>
</blockquote>

<p>Any thoughts?</p>
