gpt4 book ai didi

angular 4 httpGet withCredentials 和 header 冲突

转载 作者:太空狗 更新时间:2023-10-29 19:33:31 26 4
gpt4 key购买 nike

为了向服务器发送 cookie,我必须在选项参数中使用 { withCredentials: true },但是当我使用时

    this.http.get(this.accountUrl + 'ExternalLoginConfirmation', { 
withCredentials: true })

我收到以下错误:

    Response to preflight request doesn't pass access control check: The 
value
of the 'Access-Control-Allow-Origin' header in the response must not be
the
wildcard '*' when the request's credentials mode is 'include'. Origin
'http://localhost:4202' is therefore not allowed access. The credentials
mode of requests initiated by the XMLHttpRequest is controlled by the
withCredentials attribute.

奇怪的是:当我通过浏览器调用这个 url 时没有任何错误

你能帮帮我吗?

最佳答案

这是一个 CORS 错误,尝试添加 Cors chrome 扩展浏览器并在其中添加您的 url 此错误将消失。或永久解决引用https://stackoverflow.com/a/24446980/4808975

关于angular 4 httpGet withCredentials 和 header 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48838923/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com