Angular 为什么Safari在发送api请求时使用Web服务器凭据而不是登录凭据?

Angular 为什么Safari在发送api请求时使用Web服务器凭据而不是登录凭据?,angular,service,safari,basic-authentication,credentials,Angular,Service,Safari,Basic Authentication,Credentials,我在Angular应用程序中使用的服务使用基本身份验证,但也使用运行应用程序的服务器。Safari是唯一一款不使用Web存储中存储的凭据并通过以下方式检索的浏览器: this.service.configuration.username = JSON.parse(localStorage.getItem("basic_token")).username; this.service.configuration.password = JSON.parse(localStorage.getItem(

我在Angular应用程序中使用的服务使用基本身份验证,但也使用运行应用程序的服务器。Safari是唯一一款不使用Web存储中存储的凭据并通过以下方式检索的浏览器:

this.service.configuration.username = JSON.parse(localStorage.getItem("basic_token")).username;

this.service.configuration.password = JSON.parse(localStorage.getItem("basic_token")).password;
使用用于服务器基本身份验证的凭据。我在DeveloperTools->Network中看到了这一点。该错误仅发生在某些版本的Safari上,并且仅发生在生产环境中(localhost使用正确的凭据)

以下是服务:

public service(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
let headers = this.defaultHeaders;
if (this.configuration.username || this.configuration.password) {
headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));

// headers are printed with correct User and password
console.log(headers);
}

....................

return this.httpClient.get<any>(`${this.basePath}/service`,
{ 

withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});}
公共服务(observe:any='body',reportProgress:boolean=false):可观察{ 让headers=this.defaultHeaders; if(this.configuration.username | | this.configuration.password){ headers=headers.set('Authorization'、'Basic'+btoa(this.configuration.username+':'+this.configuration.password)); //使用正确的用户和密码打印标题 console.log(头文件); } .................... 返回此.httpClient.get(`${this.basePath}/service`, { withCredentials:this.configuration.withCredentials, 标题:标题, 观察:观察,, reportProgress:reportProgress });} 知道是什么导致了这个错误吗

谢谢大家!