因此,我收到401错误代码,我想知道是否是因为响应标头中的标头“ Access-Control-Allow-Credentials:”为true。
我的webapi(.net标准)使用Windows身份验证登录并为FE(角度)生成令牌。我将该令牌用于服务器未授权的下一个呼叫。
General:
Request URL: http://localhost:8089/FFR/status/summary
Request Method: GET
Status Code: 401 Unauthorized
Remote Address: [::1]:8089
Referrer Policy: no-referrer-when-downgrade
Response Headers:
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://localhost:4200
Content-Length: 61
Content-Type: application/json; charset=utf-8
Date: Fri, 19 Jul 2019 15:49:21 GMT
Server: Microsoft-HTTPAPI/2.0
Request Headers:
Provisional headers are shown
Accept: application/json, text/plain, */*
Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InRlc3RAZmFpcm1vcnQuY29tIiwibmFtZWlkIjoiMTExMTExMTExIiwidW5pcXVlX25hbWUiOiJUZXN0IFVzZXIiLCJuYmYiOjE1NjM1NTA2NTIsImV4cCI6MTU2NDE1NTQ1MiwiaWF0IjoxNTYzNTUwNjUyLCJpc3MiOiJ3d3cuRmFpcm1vcnQuY29tIiwiYXVkIjoid3d3LkZhaXJtb3J0LmNvbSJ9.7fGot3T3tfvmqWWAH1Ug9cajM7IpIHTBUwvSDTLi_64
Origin: http://localhost:4200
Referer: http://localhost:4200/overview-detail
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36