I am trying to access the JSON response that the following code should generate:
public static async Task<string> GetResponseString(string refreshToken)
{
var client = new HttpClient();
client.BaseAddress = new Uri("https://www.strava.com");
var request = new HttpRequestMessage(HttpMethod.Post, "/oauth/token");
var keyValues = new List<KeyValuePair<string, string>>();
keyValues.Add(new KeyValuePair<string, string>("client_id", "some_id"));
keyValues.Add(new KeyValuePair<string, string>("client_secret", "some_secret"));
keyValues.Add(new KeyValuePair<string, string>("refresh_token", refreshToken));
keyValues.Add(new KeyValuePair<string, string>("grant_type", "refresh_token"));
request.Content = new FormUrlEncodedContent(keyValues);
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
return result;
}
The expected result looks like this.
{
"token_type": "Bearer",
"access_token": "a9b723...",
"expires_at":1568775134,
"expires_in":20566,
"refresh_token":"b5c569..."
}
When doing this in Postman or Javscript the result is correct, so I guess I am not capable of accessing the task string in a correct manner :-)
Any help pointing me in the right direction will be much appreciated.
Thnx