My friend write API and sends such request to php
$response = $http->post('http://you-app.com/oauth/token',[
'form_params' => [
'grant_type' => 'password',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'username' => 'my-username',
'password' => 'my-password',
'scope' => '',
],
])
it`s my code (I work at xamarin.ios) maybe i'm sending the wrong request. (just starting to learn http request)
using (HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(60) })
{
//create my json
Request json_Request = new Request
{
Url = "http://my_url/oauth/token",
Form_params = new Params
{
Grant_Type = "password",
Client_ID = "my_client_id",
Client_Secret = "my client secret",
Username = "my username",
Password = "my password",
Scope = ""
}
};
HttpContent content = new StringContent(JsonConvert.SerializeObject(json_Request), Encoding.UTF8);
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
var response = await client.PostAsync(new Uri("http://my_url/oauth/token"), content);
if (response.IsSuccessStatusCode)
{
var response_From_Server = await response.Content.ReadAsStreamAsync();
return null;
}
else
{
return null;
}
}