OAuthAccessTokenException-提供的access_token是无效的Instagram新API

问题描述 投票:2回答:1

我正在将Instagram登录信息集成到我的应用程序中。按照下面的链接中提供的文档:https://www.instagram.com/developer/authentication/

为了获取代码,我点击了以下API:

https://api.instagram.com/oauth/authorize?app_id="your app_id"&redirect_uri=https://www.google.com/&scope=user_profile,user_media&response_type=code

在网络视图中点击上述API后,我在下面有了包含代码的新URL:

http://www.google.com/?code=AQCPw4m0jd85IX7Qi83rd-pxsFKDE8Bjb0kZ2pWZ8sarcPlNyaZXwzE1yHHqfVIgDej_ZPYrTh6_BaIafsOWsTZNJbWFDiXsQPTEZHvFBojQ5F91SBSykqjUkG0U1OS6nFyAcwNq-FsbpmBtIPcp45qNXV5_avgCCpBzG-Hndp6JiRbaF2uSgUiOep5-Uu0Ks8DiwVs_7zAfuMasJJ7PAK1gfRDNVOPC-XBYqfdPU1VlkA

在此示例中,我的代码是

AQCPw4m0jd85IX7Qi83rd-pxsFKDE8Bjb0kZ2pWZ8sarcPlNyaZXwzE1yHHqfVIgDej_ZPYrTh6_BaIafsOWsTZNJbWFDiXsQPTEZHvFBojQ5F91SBSykqjUkG0U1OS6nFyAcwNq-FsbpmBtIPcp45qNXV5_avgCCpBzG-Hndp6JiRbaF2uSgUiOep5-Uu0Ks8DiwVs_7zAfuMasJJ7PAK1gfRDNVOPC-XBYqfdPU1VlkA

我在下面的access_token请求中使用它:

https://api.instagram.com/oauth/access_token?
app_id="YOUR APP ID"
&app_secret="YOUR SECRET KEY"
&grant_type=authorization_code
&redirect_uri=https%3A%2F%2Fwww.google.com%2F
&code=AQCPw4m0jd85IX7Qi83rd-pxsFKDE8Bjb0kZ2pWZ8sarcPlNyaZXwzE1yHHqfVIgDej_ZPYrTh6_BaIafsOWsTZNJbWFDiXsQPTEZHvFBojQ5F91SBSykqjUkG0U1OS6nFyAcwNq-FsbpmBtIPcp45qNXV5_avgCCpBzG-Hndp6JiRbaF2uSgUiOep5-Uu0Ks8DiwVs_7zAfuMasJJ7PAK1gfRDNVOPC-XBYqfdPU1VlkA

以上api命中的响应:

{
    "access_token": "IGQVJVT2hod1dEN3N0UnBwTWllb3pZAaENnS0VveHZARSkNwLVpwS2Uxc0w2VUVOeEJxaUdkMnlQRkdzVGJudnh0cXREZA3BvWHNELTR1UndsOWR2MXFST0JlUG45TEdFVnhiblhScVNlYlJtLUNwQU5Kc2ltZAy1LUlRMaF9ZA",
    "user_id": 17841406439718884
}

现在为了获取用户配置文件数据,我正在使用[link] [1]中提到的access_token来访问波纹管api:

Api hit:

https://api.instagram.com/v1/users/self/?access_token=“ +访问令牌

但是在此api中,我得到了错误提示:

{
    "meta": {
        "code": 400,
        "error_type": "OAuthAccessTokenException",
        "error_message": "The access_token provided is invalid."
    }
}

[请让我知道如何以编程方式获取有效的accessToken,如果您仍然需要任何进一步校准的内容,我已经明确提及了我遵循的每个步骤,我也将为您提供!!

我已遵循此链接中提到的每一个步骤

https://developers.facebook.com/docs/instagram-basic-display-api/guides/getting-access-tokens-and-permissions

android instagram instagram-api instagram-graph-api
1个回答
0
投票

请检查您的令牌ID然后执行

© www.soinside.com 2019 - 2024. All rights reserved.