It works fine on PostMan and restClient but fails in my Xamarin.Android code. Please advise.
JSON input:
JSONObject jsonObject = new JSONObject ();
jsonObject.Put ("client_id","OTk3NGQzNmUtYmE4NS00NjA5LTkwYmItZGJkZmU1YTAxODlj");
jsonObject.Put ("client_secret","NTg5M2Q5N2YtZGI4OS00Y2I1LWJjNDUtYjE0Y2ZhMGIxYTc4");
jsonObject.Put ("response_type","code");
jsonObject.Put ("grant_type","authorization_code");
jsonObject.Put("redirect_uri","http://yourdomain.com/somepath?code=YmJkYzJmNTItZDA4My00NGJhLWJhZTgtZjZlYjcwZDZiZjYz"
);
jsonObject.Put("code","YmJkYzJmNTItZDA4My00NGJhLWJhZTgtZjZlYjcwZDZiZjYz");
var client = new RestClient ("https://api.rhapsody.com/oauth/access_token");
var request = new RestRequest ("", RestSharp.Method.POST);
request.AddParameter("application/Json", jsonObject.ToString(), ParameterType.RequestBody);
var response = client.Execute (request);
var content = response.Content;
Console.WriteLine("Result->"+content);
Response:
{"code":"BadRequestError","message":"No client ID supplied"}
Thanks
Kamal