javascript Instagram登录Access-Control-Allow-Origin错误

时间:2018-09-02 11:42:27

标签: javascript login instagram instagram-api

我遵循针对client login on Instagram的步骤,我在instagram client manager上配置了我的应用程序

我的webapp遵循以下步骤:

  1. 我在https://api.instagram.com/oauth/authorize/?client_id=<MY_CLIEND_ID>&redirect_uri=http://localhost:8080/&response_type=code

  2. 中更改了网址
  3. 我授权了我的网络应用程序

  4. 该网址变为http://localhost:8080/?code=<INSTAGRAM_ACCESS_TOKEN>

  5. 我打电话(Ajax GET请求)https://api.instagram.com/v1/tags/nofilter/media/recent?access_token=<INSTAGRAM_ACCESS_TOKEN>


但我收到此错误:

Failed to load https://api.instagram.com/v1/tags/nofilter/media/recent?access_token=INSTAGRAM_ACCESS_TOKEN : Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.

1 个答案:

答案 0 :(得分:0)

尝试使用CORSA API(前缀“ https://cors-anywhere.herokuapp.com/” + URL)调用同一Ajax,添加CORSA应该可以轻松绕过CORS。 :)