public async Task <LoginResponse> Login(string username) { var response = await httpClient.PostAsJsonWithResultAsync <LoginResponse, string>("game/user", username); if (response.IsValid) { userContext.SetUser(response.Value.User); userContext.SetToken(response.Value.Token); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", response.Value.Token); await hub.SetupAuthenticated(response.Value.Token); return(response.Value); } return(null); }