User Login: login failed: 400 Bad Request I am trying the log in rest API with Drupal 8.4 

For that, I am using angular 5

I have all the configurations working. 

This is how I get the data from the form and send it to the UserServices. The UserServices will do the post method with the correct header, the user, and the password. 

onSubmit() getting the data from the form:

onSubmit(name: string, pass:string): void {
    name = name.trim();
    if (!name) { return; }    
    let user: any = {
     name: null,
     pass: null  
    };
    user.name = {value: name};
    user.pass = { "": pass};
    console.log('Json from the form ' +JSON.stringify(user));    
    this.UserService.login(user)
      .subscribe(user =&gt; {
        console.log('subscribed to login function' + JSON.stringify(this.user));
       });
}


this is the login() function, that send the post method

login (user: User): Observable&lt;User&gt; {
  const url = `${this.mainUrl}/user/login?_format=json`;  
  const postReturn = this.http.post(url, user, httpHaljson);      
console.log('Login return from the user service' + JSON.stringify(postReturn));  
return postReturn    
}


This is my header i have tested with aplication json and haplication hal json

const httpHaljson = {
  headers: new HttpHeaders({ 
  "X-CSRF-Token": "Qfnczb1SUnvOAsEy0A_xuGp_rkompgO2oTkCBOSEItM",
  "Authorization": "Basic Qfnczb1SUnvOAsEy0A_xuGp_rkompgO2oTkCBOSEItM", // encoded user/pass - this is admin/123qwe
  // "Content-Type": "application/hal+json"
  "Content-Type": "application/json"
  })
};


Now, this is what i get from the console: User Login: login failed: Http failure response for http://drupal.dd:8083/user/login?_format=json: 403 Forbidden

This is how I send the data from the form: 
Json from the form {"name":{"value":"asd"},"pass":{"":"123"}}

Login return from the user service

{"_isScalar":false,"source":{"_isScalar":false,"source":

{"_isScalar":false,"source":{"_isScalar":true,"value":

{"url":"http://drupal.dd:8083/user/login?_format=json","body":{"name":

{"value":"asd"},"pass":

{"":"123"}},"reportProgress":false,"withCredentials":false,"responseType":"

json","method":"POST","headers":{"normalizedNames":

{},"lazyUpdate":null},"params":{"updates":null,"cloneFrom":null,"encoder":

{},"map":null},"urlWithParams":"http://drupal.dd:8083/user/login?

_format=json"},"scheduler":null},"operator":{"concurrent":1}},"operator":

{}},"operator":{}}


Any idea what am i doing wrong? thanks!
try 

const headers= new Headers({ 
  'Content-Type': 'application/json',
  'X-CSRF-Token': 'Qfnczb1SUnvOAsEy0A_xuGp_rkompgO2oTkCBOSEItM',
  'Authorization': 'Basic Qfnczb1SUnvOAsEy0A_xuGp_rkompgO2oTkCBOSEItM'
})

let options = new RequestOptions({ headers: headers });

login (user: User): Observable&lt;User&gt; {
  const url = `${this.mainUrl}/user/login?_format=json`;  
  return this.http.post(url, user, options ).map((res)=&gt;{console.log(res)});      
}