为什么我的Angular承载令牌在Firefox中不可见

为什么我的Angular承载令牌在Firefox中不可见,angular,http,authentication,Angular,Http,Authentication,我的函数如下所示: testFunctionAuth() { const promise = new Promise((resolve, reject) => { this.http.get(AppConfigService.settings.apiServer.rest + 'systems/all', { headers: { 'Authorization': 'Bearer eyJ...rxbwcO-w' } }) .subscribe(res

我的函数如下所示:

  testFunctionAuth() {
    const promise = new Promise((resolve, reject) => {
      this.http.get(AppConfigService.settings.apiServer.rest + 'systems/all', { headers: { 'Authorization': 'Bearer eyJ...rxbwcO-w' } })
        .subscribe(res => {
          resolve(res);
        },
          err => {
            console.error(err);
            reject(undefined);
          });
    });

  }
但是我得到了一个401,在标题中,Auth令牌甚至丢失了:

另一个奇怪的是Firefox说方法是OPTIONS而不是GET。为什么?

根据CORS规范,选项请求在没有身份验证标头的情况下执行。但是,您的后端似乎验证了用户凭据,但由于标头中没有身份验证令牌,服务器返回一个(未经授权)

发件人:

根据CORS是 已执行的用户凭据被排除

(…)使用方法选项,并具有以下附加约束:

  • (……)
  • 排除作者请求头
  • 排除用户凭据。
  • (……)
(重点是我的)

考虑到这一点,问题似乎在API方面, 哪个应该接受
选项
请求而不需要 身份验证