Guest User

Untitled

a guest
Nov 6th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var client = new RestClient("https://url/oauth2/token");
  2. var request = new RestRequest(Method.POST);
  3. request.AddHeader("cache-control", "no-cache");
  4. request.AddHeader("content-type", "application/x-www-form-urlencoded");
  5. request.AddHeader("Authorization", "Basic clientusername:clientpassword");
  6.  
  7. request.AddParameter("application/x-www-form-urlencoded", "grant_type=password&username=user&password=pwd", ParameterType.RequestBody);
  8. IRestResponse response = client.Execute(request);
  9.  
  10. {"fault":{"faultstring":"UrlDecoding of the form parameters from the request message failed. The form parameters needs to be url encoded","detail":{"errorcode":"steps.oauth.v2.InvalidRequest"}}}
Add Comment
Please, Sign In to add comment