registerByEmail static method

Future<AuthResult> registerByEmail(
  1. String email,
  2. String password, {
  3. AuthRequest? authData,
})

register a new user by email address and a password.

Implementation

static Future<AuthResult> registerByEmail(String email, String password,
    {AuthRequest? authData}) async {
  var body = jsonEncode({
    'email': email,
    'password': Util.encrypt(password),
    'forceLogin': true
  });
  final Result result = await post('/api/v2/register/email', body);
  AuthResult authResult = AuthResult(result);
  authResult.user = await createUser(result);
  if (authData == null) {
    return authResult;
  } else {
    if (authResult.code == 200) {
      authData.token = authResult.user?.token ?? "";
      return OIDCClient.authByToken(authData.token, authData);
    } else {
      return authResult;
    }
  }
}