I am working with Ionic, I need to send token to get the api data. The below code works fine
this.hdrs=new HttpHeaders({
Authorization:"Token "+'d5213668d34013c9087273a5efab6d39d6d8bfb9'
})
but when tried to read data from local storage, not getting the api data. Showing authorization error. The code i tried is
this.hdrs=new HttpHeaders({
Authorization:"Token "+(localStorage.getItem('token')
})
when console.log((localStorage.getItem('token'))) is tried printing the same token - "d5213668d34013c9087273a5efab6d39d6d8bfb9" Checked the type of both Both are giving string