Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var client = new RestClient("localhost:5000/api/login");
- var request = new RestRequest(Method.POST);
- request.AddJsonBody("User Model that I created");
- request.AddHeader("Accept", "application/json");
- request.RequestFormat = DataFormat.Json;
- IRestResponse response = client.Execute(request);
- //Store the response token in session
- //Subsequent calls
- var client = new RestClient("localhost:5000/api/values");
- var request = new RestRequest(Method.GET);
- request.AddHeader("authorization", "Bearer TOKEN_FROM_SESSION_STORAGE");
- request.AddHeader("content-type", "application/json");
- IRestResponse response = client.Execute(request);
Add Comment
Please, Sign In to add comment