i know this question is asked many time but still the answer of this question is not working for me this is my language service file when i am post request for login than it is work for me that cookies is set in the Cookies storage also in the Cookies header but when i am post this language api than this is show the 401 error . and also in cookie header cookie is not store and show that no request cookie where sent import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { environment } from 'src/environments/environment'; import { CookieService } from 'ngx-cookie-service'; import { Observable } from 'rxjs'; @Injectable({ providedIn: 'root', }) export class LanguageService { private languageUrl = `${environment.serverUrl}/auth/add-language`; constructor(private http: HttpClient, private cookieService: CookieService) {} updateLanguage(language: string): Observable<unknown> { const id = localStorage.getItem('userId'); const token = this.cookieService.get('jwt'); if (!token) { throw new Error('JWT token is missing'); } const payload = { language }; // Set JWT token in cookies this.cookieService.set('jwt', token); return this.http.post(`${this.languageUrl}/${id}`, payload, { withCredentials: true, }); } } Continue reading...