I have a service in Angular 6 and I\'m trying to change a record but it\'s saying I\'m not authorized.
Right now I have this:
const httpOptions = {
Looking at the angular.io documentation, it's pretty straightforward.
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': 'Basic my-auth-token'
})
};
And you can use the httpOptions
constant as you did.
For more information: https://angular.io/guide/http#adding-headers