passing in JWT Token to get response Angular?

47 views
Skip to first unread message

john.mb...@gmail.com

unread,
Feb 13, 2021, 3:28:47 PM2/13/21
to Angular and AngularJS discussion
Hi

So far I have this in my service file:

getProfile() {
const token = localStorage.getItem('token');
const header = new HttpHeaders().set('Bearer Token: ', token);
return this.http.get(this.authUrl + 'profile', {
headers: header,
});
}


I am getting 401 unauthorized but I am logging in!

Kiflemariam Andom

unread,
Feb 14, 2021, 1:22:35 PM2/14/21
to ang...@googlegroups.com
Just do. Bearer tokenvalue
Not bearer token tokenvalue

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/83344679-0629-44be-915b-8c16da1b0708n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages