loginByEmail static method

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

login by email and password.

Implementation

static Future<AuthResult> loginByEmail(String email, String password,
    [LoginOptions? options]) async {
  var body = {
    'connection': 'PASSWORD',
    'passwordPayload': {
      'email': email,
      '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;
}