I am trying to create a login page in angular and to save the cookie that is being created by our spring boot application
This is how we create the cookie in BE
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)))
This is the angular request
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});
This is the response in browser
This is the response in Postman
i have tried to add withCredentials:true
in angular request and still it didn't work