confirmUserAttribute method

Future<ConfirmUserAttributeResult> confirmUserAttribute({
  1. required AuthUserAttributeKey userAttributeKey,
  2. required String confirmationCode,
  3. ConfirmUserAttributeOptions? options,
})

Confirms a user attribute update initiated with either updateUserAttribute or updateUserAttributes.

Optionally accepts plugin options which allow customizing provider-specific behavior, e.g. the Cognito User Pool.

For more information, see the Amplify docs.

Examples

import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:amplify_flutter/amplify_flutter.dart';
Future<void> verifyAttributeUpdate() async {
  try {
    await Amplify.Auth.confirmUserAttribute(
      userAttributeKey: AuthUserAttributeKey.email,
      confirmationCode: '390739',
    );
  } on AuthException catch (e) {
    safePrint('Error confirming attribute update: ${e.message}');
  }
}

Implementation

Future<ConfirmUserAttributeResult> confirmUserAttribute({
  required AuthUserAttributeKey userAttributeKey,
  required String confirmationCode,
  ConfirmUserAttributeOptions? options,
}) =>
    identifyCall(
      AuthCategoryMethod.confirmUserAttribute,
      () => defaultPlugin.confirmUserAttribute(
        userAttributeKey: userAttributeKey,
        confirmationCode: confirmationCode,
        options: options,
      ),
    );