これは他の投稿でも回答が見られましたが、かなり古くなっています。Instagram APIアクセストークンの要求が失敗しました
私は開発者のドキュメントに従っていますが、私のlocalhostから要求を出せないようです。
$fields = array(
'client_id' => 'a2xxxxxxxxxxxxxxxxxxxxxxxxxxxxed',
'client_secret' => '3bxxxxxxxxxxxxxxxxxxxxxxxxxxxxx8f',
'grant_type' => 'authorization_code',
'redirect_uri' => 'http://localhost:8000/',
'code' => 'code'
);
$url = 'https://api.instagram.com/oauth/access_token';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
print $result; //your token
上記のコードは、私がリクエストする方法ですが、次のエラーが表示されます。私は無効に暗黙的にOAuthを持って
{"code": 400, "error_type": "OAuthException", "error_message": "Matching code was not found or was already used."}
は、設定アプリは、すべての設定がアプリはとにかくサンドボックスモードであるとして、当分の間、私の個人的なサイトに行くと、かなり基本的なものです。
「http:// localhost /」は実際のURLですが、公開されていません。私はあなた自身で答えを少し編集することができました。 – DanFromGermany