loginByRequest method

Future<LoginResponse> loginByRequest (LoginRequest request, { SpongeRequestContext context })

Sends the login request to the server and returns the response. Sets the auth token in the client for further requests.

Implementation

Future<LoginResponse> loginByRequest(LoginRequest request,
    {SpongeRequestContext context}) async {
  return await _lock.synchronized(() async {
    _currentAuthToken = null;
    LoginResponse response = await _executeDelegate(
        SpongeClientConstants.OPERATION_LOGIN,
        request,
        (json) => LoginResponse.fromJson(json),
        context);
    _currentAuthToken = response.authToken;

    return response;
  });
}