Hi,
I am trying to login with otp using this fuction
Future<User> login(String phone, String password) async {
_cognitoUser = CognitoUser(phone, _userPool, storage: _userPool.storage);
final authDetails =
AuthenticationDetails(username: phone, password: fixedPassword);
bool isConfirmed;
try {
_session = await _cognitoUser?.authenticateUser(authDetails);
isConfirmed = true;
} on CognitoUserMfaRequiredException catch (e) {
if (e.challengeName == 'SMS_MFA') {
isConfirmed = false;
print(e);
} else {
print('$e');
}
} on CognitoUserSelectMfaTypeException catch (e) {
print(e);
// handle SELECT_MFA_TYPE challenge
} on CognitoUserMfaSetupException catch (e) {
// handle MFA_SETUP challenge
print(e);
} on CognitoUserTotpRequiredException catch (e) {
// handle SOFTWARE_TOKEN_MFA challenge
print(e);
} on CognitoUserCustomChallengeException catch (e) {
// handle CUSTOM_CHALLENGE challenge
print(e);
} on CognitoUserConfirmationNecessaryException catch (e) {
// handle User Confirmation Necessary
print(e);
} on CognitoClientException catch (e) {
// handle Wrong Username and Password and Cognito Client
print(e);
}
if (!_session.isValid() || _session == null) {
return null;
}
final attributes = await _cognitoUser?.getUserAttributes();
if (attributes != null) {
final user = User.fromUserAttributes(attributes);
user.confirmed = isConfirmed;
user.hasAccess = true;
return user;
} else {
return null;
}
}
but i am getting this error
I tried to catch the error in the package with no success
cognito_user.dart
Future<CognitoUserSession?> _authenticateUserInternal( dataAuthenticate, AuthenticationHelper authenticationHelper) async {
final String? challengeName = dataAuthenticate['ChallengeName'];
var challengeParameters = dataAuthenticate['ChallengeParameters'];
if (challengeName == 'SMS_MFA') {
try {
_session = dataAuthenticate['Session'];
} on CognitoUserMfaRequiredException catch (e) {
challengeName:
challengeName;
challengeParameters:
challengeParameters;
print(e);
}
}
With try and catch i am getting this error
Are there any missing parts in the sdk regarding mfa verification ? Because when i am getting the sms and immediately the sdk
throws this error above (SMS MFA )
Also you can see how i implement my pool here #141
Hi, I am trying to login with otp using this fuction
but i am getting this error
I tried to catch the error in the package with no success
cognito_user.dart
Are there any missing parts in the sdk regarding mfa verification ? Because when i am getting the sms and immediately the sdk throws this error above (SMS MFA ) Also you can see how i implement my pool here #141
Thanks in advance for your support !