'Invalid type for parameter AuthParameters.PASSWORD: <class 'list'>, valid types: <class 'str'> due to reserved char contained in temporary password

When using the AWS Cognito user pool, after you created a user, you will receive a temporary password that might look like: "313sTz,a,Q6jnFF"

Then when you try to initiate authenticate using the following command

aws cognito-idp initiate-auth --client-id <*client-id*> --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=<*user-name*>,PASSWORD=**313sTz,a,Q6jnFF**

You might experience an issue, the reason for that is this auto-generated password contains special char in this case it's "," hence you might get this issue even if you wrap around with double quote"":

Parameter validation failed:
Invalid type for parameter AuthParameters.PASSWORD, value: ['313sTz', 'a', 'Q6jnFF'], type: <class 'list'>, valid types: <class 'str'>


Solution 1:[1]

The workaround for this issue is to have two types of quotes nested together, with a combination of both single quotes and double quotes: '""'

eg.

aws cognito-idp initiate-auth --client-id <*client-id*> --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=<*user-name*>,PASSWORD=**"'313sTz,a,Q6jnFF'"**

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kobe24