signUpWithPassword method

Future<FirebaseAccount> signUpWithPassword(
  1. String email,
  2. String password, {
  3. bool autoVerify = true,
  4. bool autoRefresh = true,
  5. String? locale,
})

Signs up to firebase with an email and a password.

This creates a new firebase account and returns it's credentials as FirebaseAccount if the request succeeds, or throws an AuthError if it fails. From now on, the user can log into this account by using the same email and password used for this request via signInWithPassword().

If autoVerify is true (the default), this method will also send an email confirmation request for that email so the users mail can be verified. See FirebaseAccount.requestEmailConfirmation() for more details. The language of that mail is determined by locale, if specified, FirebaseAuth.locale otherwise.

If autoRefresh is enabled (the default), the created accounts FirebaseAccount.autoRefresh is set to true as well, wich will start an automatic token refresh in the background, as soon as the current token comes close to expiring. See FirebaseAccount.autoRefresh for more details.

Implementation

Future<FirebaseAccount> signUpWithPassword(
  String email,
  String password, {
  bool autoVerify = true,
  bool autoRefresh = true,
  String? locale,
}) async {
  final response = await api.signUpWithPassword(
    PasswordSignInRequest(
      email: email,
      password: password,
    ),
  );
  if (autoVerify) {
    await api.sendOobCode(
      OobCodeRequest.verifyEmail(
        idToken: response.idToken,
      ),
      locale ?? this.locale,
    );
  }
  return FirebaseAccount.apiCreate(
    api,
    response,
    locale: this.locale,
    autoRefresh: autoRefresh,
  );
}