使用Instagram基本显示API的“无效的平台应用程序"错误 [英] “Invalid platform app” Error using Instagram Basic Display API
本文介绍了使用Instagram基本显示API的“无效的平台应用程序"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Instagram基本显示API,但是当我发布授权代码以获取访问令牌时,我不断收到以下错误.有人可以帮我吗?
I am trying to use Instagram Basic display API but when I post the authorization code to get the access token I keep getting the following error. Can anyone help me out from this?
错误:
{"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的方式发送参数.
I think you have to adjust the way you call. That error is when you dont send parameters in the way is waiting IG.
我在Axios上举一个例子.但是您可以使用自己喜欢的api.
I leave an example with Axios. But you can traduce to your favourite 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);
});
这篇关于使用Instagram基本显示API的“无效的平台应用程序"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文