Using HTTParty I tried to request for the access token as below:
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"],........
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
I hope this help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.