我的 Spring Boot (Spring Security) 应用程序在尝试使用http://localhost:4200/login 登录时返回 401 错误
我似乎不明白为什么我会收到 401 错误。类似的配置似乎在我在网上看到的一些示例中起作用。
这是请求结果:
Request URL: http://localhost:8080/account/login
Request Method: GET
Status Code: 401
Remote Address: [::1]:8080
Referrer Policy: no-referrer-when-downgrade
Access-Control-Allow-Origin: http://localhost:4200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: 0
Date: Wed, 24 Apr 2019 08:05:37 GMT
Expires: 0
Pragma: no-cache
Vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
WWW-Authenticate: Basic realm="Realm", Basic realm="Realm"
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Provisional headers are shown
Accept: application/json
Authorization: Basic Y2pAaG90bWFpbC5jb206Y2hyaXMx
Origin: http://localhost:4200
Referer: http://localhost:4200/login
User-Agent: …Run Code Online (Sandbox Code Playgroud) spring spring-security basic-authentication spring-boot angular