loginByAccount static method

Future<AuthResult> loginByAccount(
  1. String account,
  2. String password, [
  3. LoginOptions? options
])

login by account and password.

Implementation

static Future<AuthResult> loginByAccount(String account, String password,
    [LoginOptions? options]) async {
  var body = {
    'connection': 'PASSWORD',
    'passwordPayload': {
      'account': account,
      'password':
          Util.encrypt(password, encryptType: options?.passwordEncryptType)
    },
  };
  var jsonBody = jsonEncode(body);
  if (options != null) {
    jsonBody = jsonEncode(options.setValues(body));
  }
  final Result result = await post('/api/v3/signin', jsonBody);
  AuthResult authResult = AuthResult(result);
  authResult.user = await createUser(result);
  return authResult;
}