applyActionCode method

  1. @override
Future<Either<AuthServiceActionCodeFailure, Unit>> applyActionCode(
  1. String oobCode
)
override

Apply (consume) a Firebase out-of-band action code. For an email- verification oobCode, this flips the auth record's emailVerified to true. The code is single-use; a second call with the same code returns AuthServiceActionCodeFailure.invalidCode.

Implementation

@override
Future<Either<AuthServiceActionCodeFailure, Unit>> applyActionCode(
  String oobCode,
) async {
  try {
    logd('applyActionCode: Applying action code');
    await _fbAuth.applyActionCode(oobCode);
    logd('applyActionCode: Action code applied');
    return right(unit);
  } on fb_auth.FirebaseAuthException catch (e) {
    loge(e, 'applyActionCode failed');
    return left(_mapActionCodeException(e));
  } catch (e) {
    loge(e, 'applyActionCode failed');
    return left(AuthServiceActionCodeFailure.unexpected);
  }
}