【问题标题】:“Invalid platform app” Error using Instagram Basic Display API使用 Instagram 基本显示 API 时出现“无效平台应用”错误
【发布时间】:2020-07-21 16:59:02
【问题描述】:

我正在尝试使用 Instagram 基本显示 API,但是当我发布授权代码以获取访问令牌时,我不断收到以下错误。谁能帮我解决这个问题?

错误:

{"error_type": "OAuthException", "code": 400, "error_message": "Invalid platform app"}

代码:

val url="https://api.instagram.com/oauth/access_token/" +
            "?client_id=${InstagramId}" +
            "&client_secret=${InstagramSecret}" +
            "&grant_type=authorization_code " +
            "&redirect_uri=${RedirectUrl}" +
            "&code=${code}"

AndroidNetworking.post(url)
        .build()
        .getAsJSONObject(object : JSONObjectRequestListener {
            override fun onResponse(response: JSONObject) {
                Log.d("_TAG_", "onResponse:217 $response")
            }

            override fun onError(error: ANError) {
                error.printStackTrace()
                Log.d("_TAG_", "onError:226 ${error.errorBody} - ${error.errorCode} - ${error.errorDetail} - ${error.response}")
            }
        })

【问题讨论】:

  • 你是怎么得到代码的?

标签: android kotlin instagram instagram-api


【解决方案1】:

我认为你必须调整你打电话的方式。该错误是当您不发送参数时正在等待 IG。

我以 Axios 为例。但是你可以引用你最喜欢的 api。

 const querystring = require('querystring'); 

//Make Object with params
const data = {
      client_id: 'xxxxxxx', 
      client_secret: 'xxxxxxxxxxx',
      grant_type: 'authorization_code', 
      redirect_uri: 'https://example.com/auth',
      code: 'xxxx'
}

//Make the Call
 axios.post("https://api.instagram.com/oauth/access_token", querystring.stringify(data))
.then(function (response) {
      console.log("OK", response.data);
 })
 .catch(function (error) {
      console.log(error);
 });

【讨论】:

  • 这是一个很好的答案!不知道为什么它没有被批准!
【解决方案2】:

我遇到了类似的问题,我使用的是 facebook app id 和 app secret 而不是 instagram app id 和 app secret。要获取 Instagram 应用 ID 和密码,请转到 Facebook 开发者网站上的“Instagram 基本显示”部分。

【讨论】:

    【解决方案3】:

    您使用的是 FACEBOOK APP ID 和 SECRET 请确保 前往 Facebook 开发者网站上的“Instagram 基本显示”部分,然后向下滚动,直到找到 Instagram 应用 ID 和密码。

    【讨论】:

      猜你喜欢
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      相关资源
      最近更新 更多