同様の問題があり、リクエストのコンテンツタイプをapplication / x-www-form-urlencodedに設定することで解決できました。以下はリクエストを実行する方法を示すC#の例です:
public async Task<UserTokenResponseModel> GetUserToken(string code)
{
var url =
$"https://api.instagram.com/oauth/access_token";
var request = new HttpRequestMessage(HttpMethod.Post, url);
var client = _httpClientFactory.CreateClient();
var requestContent = new List<KeyValuePair<string, string>>();
requestContent.Add(new KeyValuePair<string, string>("client_id", ClientId));
requestContent.Add(new KeyValuePair<string, string>("client_secret", Secret));
requestContent.Add(new KeyValuePair<string, string>("grant_type", "authorization_code"));
requestContent.Add(new KeyValuePair<string, string>("code", code));
requestContent.Add(new KeyValuePair<string, string>("redirect_uri", "https://localhost:44315/instagram/authorizecallback"));
request.Content = new FormUrlEncodedContent(requestContent);
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
throw new Exception(content);
}
return JsonConvert.DeserializeObject<UserTokenResponseModel>(content);
}