RestSharp HttpBasicAuthentication - example

后端 未结 5 1499
梦毁少年i
梦毁少年i 2021-01-03 20:51

I have a WPF client using RestSharp and WEB API Service. I try to use HttpBasicAuthenticator as follows:

RestRequest login = new RestRequest(\"/         


        
5条回答
  •  独厮守ぢ
    2021-01-03 21:39

    RestClient restClient = new RestClient(baseUrl);
    restClient.Authenticator = new RestSharp.Authenticators.HttpBasicAuthenticator("admin","22");
    
    RestRequest login = new RestRequest("/api/users/login", Method.POST);
    IRestResponse response = restClient.Execute(login);
    

提交回复
热议问题