setSettings method

Future<void> setSettings(
  1. {bool appVerificationDisabledForTesting = false,
  2. String? userAccessGroup,
  3. String? phoneNumber,
  4. String? smsCode,
  5. bool? forceRecaptchaFlow}
)

Updates the current instance with the provided settings.

appVerificationDisabledForTesting This setting applies to Android, iOS and web platforms. When set to true, this property disables app verification for the purpose of testing phone authentication. For this property to take effect, it needs to be set before handling a reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is useful for manual testing during development or for automated integration tests.

In order to use this feature, you will need to whitelist your phone number via the Firebase Console.

The default value is false (app verification is enabled).

forceRecaptchaFlow This setting applies to Android only. When set to 'true', it forces the application verification to use the web reCAPTCHA flow for Phone Authentication. Once this has been called, every call to PhoneAuthProvider#verifyPhoneNumber() will skip the SafetyNet verification flow and use the reCAPTCHA flow instead. Calling this method a second time will overwrite the previously passed parameter.

phoneNumber & smsCode These settings apply to Android only. The phone number and SMS code here must have been configured in the Firebase Console (Authentication > Sign In Method > Phone). Once this has been called, every call to PhoneAuthProvider#verifyPhoneNumber() with the same phone number as the one that is configured here will have onVerificationCompleted() triggered as the callback. Calling this method a second time will overwrite the previously passed parameters. Only one number can be configured at a given time. Calling this method with either parameter set to null removes this functionality until valid parameters are passed. Verifying a phone number other than the one configured here will trigger normal behavior. If the phone number is configured as a test phone number in the console, the regular testing flow occurs. Otherwise, normal phone number verification will take place. When this is set and PhoneAuthProvider#verifyPhoneNumber() is called with a matching phone number, PhoneAuthProvider.OnVerificationStateChangedCallbacks.onCodeAutoRetrievalTimeOut(String) will never be called.

userAccessGroup This setting only applies to iOS and MacOS platforms. When set, it allows you to share authentication state between applications. Set the property to your team group ID or set to null to remove sharing capabilities.

Key Sharing capabilities must be enabled for your app via XCode (Project settings > Capabilities). To learn more, visit the Apple documentation.

Implementation

Future<void> setSettings({
  bool appVerificationDisabledForTesting = false,
  String? userAccessGroup,
  String? phoneNumber,
  String? smsCode,
  bool? forceRecaptchaFlow,
}) {
  return _delegate.setSettings(
    appVerificationDisabledForTesting: appVerificationDisabledForTesting,
    userAccessGroup: userAccessGroup,
    phoneNumber: phoneNumber,
    smsCode: smsCode,
    forceRecaptchaFlow: forceRecaptchaFlow,
  );
}