Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: USER_PASSWORD_AUTH flow activates 'PASSWORD_VERIFIER' challenge #346

Open
Shpionus opened this issue Dec 7, 2022 · 0 comments
Open

Comments

@Shpionus
Copy link

Shpionus commented Dec 7, 2022

userPasswordAuthFlow by default returns verifyPasswordChallenge (ref).

But USER_PASSWORD_AUTH does not require providing DEVICE_KEY

Steps to reproduce:

  1. Crate pool
aws --endpoint http://127.0.0.1:5000 cognito-idp create-user-pool \
        --pool-name $POOL_NAME \
        --query UserPool.Id --output text \
        --policies "PasswordPolicy={MinimumLength=6,RequireUppercase=true,RequireLowercase=true,RequireNumbers=true,RequireSymbols=true,TemporaryPasswordValidityDays=7}" \
        --username-attributes "email" \
        --account-recovery-setting 'RecoveryMechanisms=[{Priority=1,Name=verified_email}]'
  1. Create client
aws --endpoint http://127.0.0.1:5000 cognito-idp create-user-pool-client \
        --user-pool-id $POOL_ID  \
        --client-name $CLIENT_NAME \
        --no-generate-secret \
        --explicit-auth-flows "ALLOW_USER_PASSWORD_AUTH" "ALLOW_REFRESH_TOKEN_AUTH" \
        --prevent-user-existence-errors ENABLED \
        --query UserPoolClient.ClientId --output text\
  1. Sign up
aws --endpoint http://127.0.0.1:5000 cognito-idp sign-up \
        --client-id $CLIENT_ID \
        --username [email protected] \
        --password "1qazXSW@"  \
        --user-attributes Name="email",Value="[email protected]"
{
    "UserConfirmed": false,
    "UserSub": "7c82e5cc-99b6-468d-8c33-9bb0272bbbfe"
}
  1. Sign in
aws --endpoint http://127.0.0.1:5000 cognito-idp initiate-auth \
        --auth-flow USER_PASSWORD_AUTH \
        --auth-parameters USERNAME="[email protected]",PASSWORD="1qazXSW@" \
        --client-id $CLIENT_ID \
        --debug
{
    "ChallengeName": "PASSWORD_VERIFIER",
    "ChallengeParameters": {},
    "AuthenticationRes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L2xvY2FsaG9zdDo5MjI5L2xvY2FsXzNwT3lKd2lCIn0.DKevzXf4q3eKmjMe2ZPtJDkbNfHeFQ4sKB_juMKPSLh9QkaCxE0qWCJ7gYgeLEn1diCv72WvfkOLpMxVnkPIK36CDGtPJvEpXXIL8I9VWVj4OdwdPMMJLvhBQG7sZdFebBGbY2CiPU-NPoGSIo0rEli3d3E7AzSTPPek6Qfu1jOM3Cr7JTfC60u8o_v_eoas9qncnT826GnAf6Bw8qx5MMjqoMx9f6-5enmmZU4Fwhq5jE9r4xkaI2vV40WV6G5JdlYYgOxK7AmIBlchkeirX8U1F6Lj4Smf_rWWfr64RPmCLiBD86n0Pw0wCd92S40gHQqtbqWhn28lLTyRMqb2kA"
    }
}

Expected: 'UserNotConfirmedException'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant