I'm trying to get auth token from response headers this is my code in auth.service.ts
login(email: string, password: string): Observable<any> {
const url = `${this.apiUrl}/auth/login`;
const body = {
Email: email,
Password: password,
};
return this.http.post(url, body, { observe: 'response' }).pipe(
map((response) => {
console.log(response.headers.keys());
const bearerToken = response.headers.get('Authorization');
console.log(bearerToken);
return response;
})
);
}
but actually I didn't find it the only 2 headers I found in the console are ['content-length', 'content-type']
What is the problem here??