我正在尝试使用 Instagram 基本显示 API,但是当我发布授权代码以获取访问 token 时,我不断收到以下错误。谁能帮我解决这个问题?
错误:
{"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}")
}
})
最佳答案
我认为你必须调整你打电话的方式。该错误是当您不以等待 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);
});
关于android - “Invalid platform app” 使用 Instagram 基本显示 API 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63019404/