furaiev / amazon-cognito-identity-dart-2

Unofficial Amazon Cognito Identity Provider Dart SDK, to easily add user sign-up and sign-in to your mobile and web apps with AWS.
MIT License
182 stars 113 forks source link

sendMFACode method requires SECRET_HASH #249

Closed hiromumachi closed 6 months ago

hiromumachi commented 8 months ago

In my project,when the user logs in, we do sms authentication. At that time, the following error will occur.

statusCode: 400, code: NotAuthorizedException, name: NotAuthorizedException, message: Client 67eb1d3nh97o2l6goh8pq3pnqd is configured with secret but SECRET_HASH was not received

The secret is included when creating the instance.

final cognitoUser = CognitoUser(
      phoneNumber,
      userPool,
      clientSecret: secret,
    );
    CognitoUserSession? session;
    try {
      devLog('MFA code sent');
      session = await cognitoUser.sendMFACode(confirmationCode);
     :
     :
     :

Looking at the other methods, the following code that puts SecretHash is I can't find it in sendMFACode, so I think this is the cause.

if (_clientSecretHash != null) {
      challengeResponses['SECRET_HASH'] = _clientSecretHash;
    }

If there is a difference in consideration or implementation, please let me know.

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 6 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.