HttpClient PostAsync() never return response

后端 未结 3 1725
-上瘾入骨i
-上瘾入骨i 2021-01-03 21:51

My problem is very similar to this question here. I have an AuthenticationService class that makes an HttpClient PostAsync() and never

3条回答
  •  有刺的猬
    2021-01-03 22:49

    In case someone comes and needs to see code I just change the controller to something like this:

        /***
        *** Added async and Task
        ****/
        public async Task Signin(User user)
        {
            //no token needed - we are requesting one
            // added await and remove .Result()
            Token token =  await _authenticationService.Authenticate(user, ApiUrls.Signin);
    
            return RedirectToAction("Index", "Dashboard", token.user);
        }
    

    Thank you all for your quick response!

提交回复
热议问题