バックエンドにlaravelを使用していて、Instagram APIにjQueryでリクエストを送信しようとしていますが、ChromeブラウザインスペクタPHP Nginxで 'Access-Control-Allow-Origin'エラーが発生しました
test?code=a3679b3…:1 XMLHttpRequest cannot load https://api.instagram.com/oauth/access_token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
、これは要求
$.ajax({
method: 'POST',
url: 'https://api.instagram.com/oauth/access_token',
data: {
client_id: "client_id",
client_secret: "client_secret",
grant_type: "authorization_code",
redirect_uri: "example.com",
code: "{{$code}}"
}
});
を送信するために私のコードで私はnginxのdefault.conf
ファイルにAccess-Control-Allow-Origin
を追加しようとしましたが、私の問題を解決していないことをしました。どうすれば修正できますか?
私はあなたがこのリンクをたどることができると思います。これが助けになるかもしれない。 [http://stackoverflow.com/questions/6114436/access-control-allow-origin-error-sending-a-jquery-post-to-google-apis](http://stackoverflow.com/questions/6114436/) google-apiに投稿するアクセス制御を許可する元のエラーを送信する) –