How to use OAuth2 in RestSharp

See RFC 6749 – 4.4.2. Client Credentials – Access Token Request Here is the basic format of the request POST /token HTTP/1.1 Host: server.example.com Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW Content-Type: application/x-www-form-urlencoded grant_type=client_credentials Your cURL request curl -H “Accept: application/json” \ -d grant_type=client_credentials \ client-app:[email protected]/myapi/oauth/token The reason your cURL command works Default Content-Type (if not specified) with POST … Read more

reading HttpwebResponse json response, C#

First you need an object public class MyObject { public string Id {get;set;} public string Text {get;set;} … } Then in here using (var twitpicResponse = (HttpWebResponse)request.GetResponse()) { using (var reader = new StreamReader(twitpicResponse.GetResponseStream())) { JavaScriptSerializer js = new JavaScriptSerializer(); var objText = reader.ReadToEnd(); MyObject myojb = (MyObject)js.Deserialize(objText,typeof(MyObject)); } } I haven’t tested with the … Read more

Http Post request with content type application/x-www-form-urlencoded not working in Spring

The problem is that when we use application/x-www-form-urlencoded, Spring doesn’t understand it as a RequestBody. So, if we want to use this we must remove the @RequestBody annotation. Then try the following: @RequestMapping(value = “/patientdetails”, method = RequestMethod.POST,consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) public @ResponseBody List<PatientProfileDto> getPatientDetails( PatientProfileDto name) { List<PatientProfileDto> list = new ArrayList<PatientProfileDto>(); list = service.getPatient(name); … Read more

HTTP Basic Authentication instead of TLS client certification

[the] poster says if we dont use client SSL certification server does not really know whom its talking to. That’s not what I said 🙂 This is what I said: Unless you’re using TLS client authentication, SSL alone is NOT a viable authentication mechanism for a REST API. alone being the key word here. Also: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)