Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/445.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript httpclient响应中不存在设置Cookie_Javascript_Angular_Spring Boot_Postman_Angular Httpclient - Fatal编程技术网

Javascript httpclient响应中不存在设置Cookie

Javascript httpclient响应中不存在设置Cookie,javascript,angular,spring-boot,postman,angular-httpclient,Javascript,Angular,Spring Boot,Postman,Angular Httpclient,我试图在angular中创建一个登录页面,并保存spring引导应用程序创建的cookie 这就是我们在BE中创建cookie的方式 val cookie = createCookie(jwtProperties.cookieName, token, expirySeconds, false, true, jwtProperties.cookieDomain, "/", "sample comment") response.addC

我试图在angular中创建一个登录页面,并保存spring引导应用程序创建的cookie

这就是我们在BE中创建cookie的方式

val cookie = createCookie(jwtProperties.cookieName, token, expirySeconds,
                false, true, jwtProperties.cookieDomain, "/",
                "sample comment")
response.addCookie(cookie)
response.status = HttpServletResponse.SC_OK
response.contentType = MediaType.APPLICATION_JSON_VALUE
response.writer.write(objectMapper.writeValueAsString(JwtGetDto(token)))
这是角度要求

const headers = new HttpHeaders({
            'Content-Type': 'application/json'
        });
const url = `${environment.api_url}/api/v1/auth/login`
return this._http.post(url, JSON.stringify({ username: username, password: password }), { observe: 'response', headers: headers});
这是浏览器中的响应

这是《邮递员》中的回应


我尝试在angular request中添加
withCredentials:true
,但仍然无效

是否与CORS相关?当我第一次设置凭据:true时,它确实给了我一些cors错误,但我修复了我添加了访问控制允许凭据和访问控制允许源的问题,请求进行得很顺利,但设置cookie头仍然丢失。您可以通过
curl
或等效工具检查它是否存在吗?设置cookie头在curl中存在,因此我假设问题出在我做这个问题的方式上,找到了解决方案?