title: Uncaught (in promise): Response with status: 401 Unauthorized for URL
body: <p><a href="https://i.stack.imgur.com/9lewp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9lewp.png" alt="enter image description here"></a>I am trying to implement authGuard for my Routers.  but when I interfere with error codes, the app breaks actually. I don't know how to tackle it. assistance needed.</p>
  
  <p>My AuthGuard</p>
  
  <pre><code>  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable&lt;boolean&gt; | boolean {
  
      return this._auth.validate()
        .map((isValidated) =&gt; {
          if (isValidated &amp;&amp; localStorage.getItem('authToken') &amp;&amp; this.checkCookie()) {
            return true;
          }
          this.router.navigate(['/login'], { queryParams: { returnUrl: state.url } });
          return false;
        });
    }
  </code></pre>
  
  <p>My Auth Service</p>
  
  <pre><code>@Injectable()
  export class AuthService {
  
    loginStatus;
  
    constructor(private http: Http, private _apiEndPoint: ApiEndPoint, private router: Router) { }
  
    validate() {
  
      return this.http.get(this._apiEndPoint.validate)
        .map(
        (response: Response) =&gt; {
  
          const result = response.json();
  
          // check authentication status from response
          if (result.authenticated) {
            return true;
          } else {
            return false;
          }
        })
      .catch(error =&gt; Observable.throw(error));
    }
  
  }
  </code></pre>
  
  <p>I am getting this error, Uncaught (in promise): Response with status: 401 Unauthorised for URL.</p>
  
  <p><a href="https://i.stack.imgur.com/9lewp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9lewp.png" alt="ScreenShot of my Error"></a></p>
  
  <p>and when I get that error my page goes all blank.</p>