[英]Instagram API - Unable to request access token
Using HTTParty I tried to request for the access token as below: 我使用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'}
})
But the response says that #400, "error_type"=>"OAuthException", "error_message"=>"You must provide a client_id"}, @response=#, @headers={"content-language"=>["en"], "expires"=>["Sat, 01 Jan 2000 00:00:00 GMT"],........ 但是响应说#400,“ error_type” =>“ OAuthException”,“ error_message” =>“您必须提供一个client_id”},@ response =#,@headers = {“ content-language” => [“ en “],” expires“ => [” Sat,01 Jan 2000 00:00:00 GMT“],........
Can't figure out why.. Help! 不知道为什么..帮助!
You can change content-type into: 您可以将内容类型更改为:
'Content-Type' => 'application/x-www-form-urlencoded'
For more information click instagram-api-authentication-must-provide-client-id 有关更多信息,请单击instagram-api-authentication-must-provide-client-id
I hope this help you. 希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.