[英]Troubles Fetching a Long-lived Access Token from the Instagram Basic Display API
I am trying to work with the Instagram Basic Display API and I am getting stuck at obtaining a long-lived access token.我正在尝试使用 Instagram 基本显示 API,但在获取长期访问令牌时遇到了困难。 Hoping some of you folks can help me narrow down my issue.希望你们中的一些人可以帮助我缩小问题的范围。 Ive been making my way through Meta for Developers 'Get Started', currently stuck on Step 5: Exchange the Code for a Token:我一直在通过 Meta for Developers 'Get Started',目前停留在第 5 步:用代码交换令牌:
I've made it to the point where you can click to authenticate the Instagram test user, to which you get a redirected URI with an 'authorization code' appended to it.我已经做到了,您可以单击以对 Instagram 测试用户进行身份验证,您将获得一个重定向的 URI,并附有“授权代码”。 I then take that code and make a POST to https://api.instagram.com/oauth/access_token with the following params:然后我使用该代码并使用以下参数对https://api.instagram.com/oauth/access_token进行 POST:
client_id={insta-app-id} client_id={insta-app-id}
client_secret={insta-app-secret} client_secret={insta-app-secret}
grant_type=authorization_code grant_type=authorization_code
redirect_uri={redirect-uri} code={authorization-code} redirect_uri={redirect-uri} 代码={授权码}
I then get this response: { "error_type": "OAuthException", "code": 400, "error_message": "Missing required field client_id" }然后我得到这个响应: { "error_type": "OAuthException", "code": 400, "error_message": "Missing required field client_id" }
And if you find it helpful, this is more info about my approach:如果你觉得它有帮助,这是关于我的方法的更多信息:
Everything seems perfect.一切似乎都很完美。 Try an attempt on postman or web browser .尝试使用邮递员或网络浏览器。
Can you share the exact post you did?你能分享你做的确切帖子吗?
It sounds like a syntax error in the POST request.这听起来像是 POST 请求中的语法错误。
I opened a terminal and ran this exact CURL request:我打开了一个终端并运行了这个确切的 CURL 请求:
curl -X POST \
https://api.instagram.com/oauth/access_token \
-F client_id={app-id} \
-F client_secret={app-secret} \
-F grant_type=authorization_code \
-F redirect_uri={redirect-uri} \
-F code={code}
I got back json:我回来了 json:
{"id":"<user_id>", "username":"<username>"}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.