title: Angular 2 auth seems not to work, although I receive a success message
body: <p>I set up an auth with Node, and it works fine with e.g. Postman. But in Angular, it seems I did something wrong. I created a service and the auth() function is called on button click.</p>
  
  <p>When I click the button, I can see that I receive a 200 status, and I receive the success message that I created in the backend. I want to redirect to the /dashboard a successful login, but somehow I receive a 401 unauthorized error (a GET function is called in the DashboardComponent). The credentials are 100% right (otherwise I wouldn't receive a success mesage). Like I said, it works on Postman.</p>
  
  <p>What did I do wrong? Thank you !</p>
  
  <p>Here is the code of the service:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { env } from '../../../../.env';
  import { Http, Response } from '@angular/http';
  import 'rxjs/add/operator/map';
  import 'rxjs/add/operator/catch';
  import 'rxjs/add/operator/toPromise';
  
  import { Router } from '@angular/router';
  
  @Injectable()
  export class LoginService {
  
    constructor(private _http : Http, private router: Router) {}
  
    public auth(creds) {
      return this._http
          .post(env.apiUrl + '/api/auth', creds)
          .map((response:Response) =&gt; {
            return this.successfulAuth(response);
          });
    }
  
    private successfulAuth(response) {
      response = response.json();
      if(response.success === 1) {
        // this works !
        this.router.navigateByUrl('/dashboard');
      }
      return [];
    }
  
  }
  </code></pre>