Answer the question
In order to leave comments, you need to log in
How to get a cookie in Angular and save it?
I'm trying to fetch the cookie, because using the standard Angular httpClient, cookies are not saved and I can't get them.
I write like this
public urlapi = 'https://server.com/api';
private httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'X-SourceId': '11111111111'
})
}; //если я добавлю withCredentials: boolean, то сервер не отдаёт данные
this.http
.post(this.urlapi, postBody, this.httpOptions)
.pipe(map(data => { ........... }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question