繁体   English   中英

Instagram API-无法请求访问令牌

[英]Instagram API - Unable to request access token

我使用HTTParty尝试请求访问令牌,如下所示:

result = HTTParty.post("https://api.instagram.com/oauth/access_token",
{ 
  :body => [ { "client_id" => xxxxxxxxxx, "client_secret" => xxxxxxxxxxxxx,
  "grant_type" => "authorization_code",
  "redirect_url" => 'http://localhost:4000/access_token', "code" => xxxxxxxx } ].to_json,
  :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
})

但是响应说#400,“ error_type” =>“ OAuthException”,“ error_message” =>“您必须提供一个client_id”},@ response =#,@headers = {“ content-language” => [“ en “],” expires“ => [” Sat,01 Jan 2000 00:00:00 GMT“],........

不知道为什么..帮助!

您可以将内容类型更改为:

'Content-Type' => 'application/x-www-form-urlencoded'

有关更多信息,请单击instagram-api-authentication-must-provide-client-id

希望对您有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM