Authenticate the Test User { "error_type": "OAuthException", "code": 400, "error_message": "Invalid platform app" }

Felice!

When setting up an Instagram app, you should use the platform specific App ID and not the generic one setup on Facebook.

In your Facebook app Dashboard go to Products > Instagram > Basic Display and should see the Instagram App ID.

Use that in your authorization URL and it should work.


Passing parameters through the body and in x-www-form-urlencoded works fine as you can see in the picture below enter image description here


I had a similar issue and was able to resolve it by setting the content type of the request to application/x-www-form-urlencoded. below is a c# example showing how to execute the request:

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);
    }