更新时间:2023-09-13 23:29:58
在配置 $ httpProvider
的文件中,添加此行以指定您要发送包含跨站点请求的凭据:
In the file where you configure your $httpProvider
, add this line to specify you want to send credentials with cross-site requests:
$httpProvider.defaults.withCredentials = true;
通常,AngularJS会自动发送这些带有请求的cookie(针对同源请求)但是因为您的请求是跨站点然后你必须手动配置它。
Typically, AngularJS will automatically send these cookies with requests (for same-origin requests) but since your requests are cross-site then you have to manually configure this.