jQuery, CORS, JSON (without padding) and authentication issues

前端 未结 3 581
滥情空心
滥情空心 2021-01-14 02:45

I have two domains. I\'m trying to access a JSON object from one domain through a page on another. I\'ve read everything I could find regarding this issue, and still can\'t

3条回答
  •  走了就别回头了
    2021-01-14 03:10

    Welp, now that I have enough rep a while later, I might as well answer this question and accept it.

    When you attempt to send a GET json request to a server with headers, the browser first sends an OPTION request to make sure that you can access it. Unfortunately, this OPTION request cannot carry with it any authentication. This means that if you want to send a GET with auth, the server must allow an OPTION without auth. Once I did this, things started working.

提交回复
热议问题