I have a WPF client using RestSharp services and WEB API. I am trying to use the HttpBasicAuthenticator as follows:
RestRequest login = new RestRequest("/api/users/login", Method.POST); var authenticator = new HttpBasicAuthenticator("admin","22"); authenticator.Authenticate(Client, login); IRestResponse response = Client.Execute(login);
The POST request is as follows:
POST http://localhost/api/users/login HTTP/1.1 Authorization: Basic YWRtaW46MjI= Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml User-Agent: RestSharp/105.1.0.0 Host: dellnote:810 Content-Length: 0 Accept-Encoding: gzip, deflate Connection: Keep-Alive
- How to handle this field,
Authorization: Basic YWRtaW46MjI= server-side? Do I get a username and password from this header? - How to return a security token from the server to the client and save it on the client side?
I need to get a simple authentication based on a security token, but I can not find an example that describes all aspects of this process. Can someone point me to some complete example that includes the client and server side (and uses RestSharp).
Romas source share