confirmSignUpCode method

  1. @override
Future<bool> confirmSignUpCode(
  1. String username,
  2. String code
)
override

Confirm the registration of a particular username with the given code

Implementation

@override
Future<bool> confirmSignUpCode(
  String username,
  String code,
) async {
  try {
    final result = await _amplifyAuth.confirmSignUp(
      username: username,
      confirmationCode: code,
    );
    _logger.fine('Successfully confirmed sign up code: $result');

    return result.isSignUpComplete;
  } on aws_cognito.CodeMismatchException catch (e) {
    throw InvalidCodeException(
      message: e.message,
      innerException: e,
      innerStackTrace: StackTrace.current,
    );
  } on aws_cognito.ExpiredCodeException catch (e) {
    throw ExpiredCodeException(
      message: e.message,
      innerException: e,
      innerStackTrace: StackTrace.current,
    );
  } on aws_cognito.AuthException catch (e) {
    throw ConfirmSignUpCodeException(
      message: 'failed to confirm sign up',
      innerException: e,
      innerStackTrace: StackTrace.current,
    );
  }
}