authenticateEmail method

  1. @override
Future<Session> authenticateEmail({
  1. required String email,
  2. required String password,
  3. bool create = true,
  4. String? username,
  5. Map<String, String>? vars,
})
override

Implementation

@override
Future<model.Session> authenticateEmail({
  required String email,
  required String password,
  bool create = true,
  String? username,
  Map<String, String>? vars,
}) async {
  final request = AuthenticateEmailRequest()
    ..create_2 = BoolValue(value: create)
    ..account = (AccountEmail()
      ..email = email
      ..password = password
      ..vars.addAll(vars ?? {}));

  if (username != null) {
    request.username = username;
  }

  final res = await _client.authenticateEmail(request);

  return model.Session(
    created: res.created,
    token: res.token,
    refreshToken: res.refreshToken,
  );
}