title: Angular 7 Authorization Not working correctly
body: <p>I'm working on implementing Authentication I am using an interceptor to do this with. However, I'm getting an error.</p>
  
  <blockquote>
    <p>"Authorization has been denied for this request."</p>
  </blockquote>
  
  <p>Below is the interceptor code.</p>
  
  <pre><code>@Injectable()
  export class AuthenticationInterceptor implements HttpInterceptor{
  
  
      constructor(@Inject('IAuthService') private authService:IAuthService) {          
      }
  
      intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler):
  
  
      Observable&lt;HttpEvent&lt;any&gt;&gt; {
          if(this.authService.isLoggedIn){
              req = req.clone({
                  headers: req.headers.set('Authorization', `Bearer ${this.authService.token}`)
                });
          }
          return next.handle(req);
      }
  }
  </code></pre>
  
  <p>And this is shown in the request that it is adding the token to the 
  <a href="https://i.stack.imgur.com/c3JYr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c3JYr.png" alt="Request Headers"></a>:</p>
  
  <p>So I can make the request from Postman and return the correct data.</p>
  
  <p>Just so you can see the full error:</p>
  
  <blockquote>
    <p>ERROR Error: Uncaught (in promise): HttpErrorResponse:
    {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":401,"statusText":"Unauthorized","url":"<a href="http://localhost/Invoicing/api/users/settings/getTableColumns/leads-list" rel="nofollow noreferrer">http://localhost/Invoicing/api/users/settings/getTableColumns/leads-list</a>","ok":false,"name":"HttpErrorResponse","message":"Http
    failure response for
    <a href="http://localhost/Invoicing/api/users/settings/getTableColumns/leads-list" rel="nofollow noreferrer">http://localhost/Invoicing/api/users/settings/getTableColumns/leads-list</a>:
    401 Unauthorized","error":{"message":"Authorization has been denied
    for this request."}}
        at resolvePromise (zone.js:814)
        at resolvePromise (zone.js:771)
        at zone.js:873
        at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask
    (zone.js:421)
        at Object.onInvokeTask (core.js:16147)
        at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask
    (zone.js:420)
        at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
        at drainMicroTaskQueue (zone.js:595)
        at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask
    [as invoke] (zone.js:500)
        at invokeTask (zone.js:1540)</p>
  </blockquote>
  
  <p>Is there something I'm missing here?</p>