observe: response doesn't return headers when used with withcredentials : true

Viewed 9

this is the call that I want to make

let data = {"username": credentials.username, "password" : credentials.password }


return this._httpClient.post('http://localhost:8080/tobris-erp/login.jsp', data,  {observe: "response", withCredentials: true  }).pipe(
           map( (res:any) => {
                    
                    console.log("res", res)
                    this._authenticated = true;
                
                    return of (res)
              })
 )

when I use observer: "response" alone I can get the headers. but when I add withCredentials: true the response headers become empty.

1 Answers

the bug was not related to angular. I changed the cors.expose.headers = * to cors.expose.headers = X-CSRF-Token

in the spring boot application

Related