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
188 stars 114 forks source link

sendMFACode method requires SECRET_HASH #249

Closed hiromumachi closed 9 months ago

hiromumachi commented 11 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 9 months ago

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

github-actions[bot] commented 9 months ago

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