title: OAuth in Angular 9
body: <p>I'm trying implement OAuth in Angular 9, but when I send the post request to URL that will generate the token I recept error 401 because I need a first authorization to do this, but I don't now how implement the autorizathion request.</p>
  
  <p>the auth.service.ts</p>
  
  <pre><code>  // Sign-in
    signIn(user: User) {
      console.log(user);
      return this.http.post('https://credbem-app.herokuapp.com/oauth/token', user)
        .subscribe(res =&gt; {
          localStorage.setItem('access_token', res.token)
        });
    }
  
    getToken() {
      return localStorage.getItem('access_token');
    }
  </code></pre>
  
  <p>the authconfig.interceptor.ts</p>
  
  <pre><code>export class AuthInterceptor implements HttpInterceptor {
      constructor(private authService: AuthService) { }
  
      intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler) {
          const authToken = this.authService.getToken();
          req = req.clone({
              setHeaders: {
                  Authorization: "Bearer " + authToken
              }
          });
          return next.handle(req);
      }
  }
  </code></pre>