saveStudentDetails(values) {
const studentData = {};
studentData['id'] = values.id;
studentData['password'] = values.password;
this.crudService.loginstudent(studentData).subscribe(result => {
// Here should be the value of the header from backend to be stored in localstorage
this.toastr.success('You are logged in', 'Success !', { positionClass: 'toast-bottom-right' });
this.router.navigate(['/address']);
},
err => {
console.log('status code ->' + err.status);
this.toastr.error('Please try again', 'Error !', { positionClass: 'toast-bottom-right' });
});
https://i.sstatic.net/9kxxI.png
I possess a JWT token that is placed in the Authorization header upon user login, and I am seeking a method to extract the token from the Authorization header and store it in local storage for usage across different routes. Any assistance on this matter would be greatly appreciated.