OAuthAccessTokenException-The access_token provided is invalid Instagram new api

喜你入骨 提交于 2019-12-17 14:54:12

问题


I am integrating Instagram login into my application. As per the provided documentation in bellow link: https://www.instagram.com/developer/authentication/

For getting CODE I hit follow 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

After hitting above API in web-view I got bellow new URL with code in it:

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

In this example my code is

AQCPw4m0jd85IX7Qi83rd-pxsFKDE8Bjb0kZ2pWZ8sarcPlNyaZXwzE1yHHqfVIgDej_ZPYrTh6_BaIafsOWsTZNJbWFDiXsQPTEZHvFBojQ5F91SBSykqjUkG0U1OS6nFyAcwNq-FsbpmBtIPcp45qNXV5_avgCCpBzG-Hndp6JiRbaF2uSgUiOep5-Uu0Ks8DiwVs_7zAfuMasJJ7PAK1gfRDNVOPC-XBYqfdPU1VlkA

I use it in access_token request below:

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

Response of above api hit:

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

Now in order to get User Profile data, I am hitting bellow api using above access_token as mentioned in [link][1] :

Api hit :

https://api.instagram.com/v1/users/self/?access_token="+accesstoken

But in this api, I am getting error which says:

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

Please let me know how to get valid accessToken programmatically , I have clearly mentioned every step I follow if you stil need anything for more calrification I willprovide you that too!!!

I have followed each and every step mentioed in this link :

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


回答1:


please check your token id then executed



来源:https://stackoverflow.com/questions/59052304/oauthaccesstokenexception-the-access-token-provided-is-invalid-instagram-new-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!