1
I need to recover the token that comes in Authorization and save in localstorage, but, I’m not getting.
My login method within my service is:
public login(email: string, password: string): Observable<User> {
return this.http.post<User>(this.url, { username: email, password: password })
.do(user => {
this.user = user;
});
}
I believe this information I can retrieve from Subscriber:
public login(): void {
this.signinService.login(this.loginForm.value.email, this.loginForm.value.password).subscribe(
user => {
this.notificationService.notify(`Usuário logado com sucesso`);
},
(response: HttpErrorResponse) => this.notificationService.notify(response.error.message),
() => {
this.router.navigate([atob(this.navigateTo)]);
});
}
give a look here https://stackoverflow.com/questions/50968674/angular-6-get-response-headers-with-httpclient-issue
– Willian