I need to retrieve the Token that comes in the authorization and save it in the localstorage, but I'm not getting it.
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 recover 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)]);
});
}