Error in the request from angular to service made with symfony

1

When I make my post request from angular towards service done with symfony, it responds that there is an error in the request, also in the grant_type, (use oauth 2.0 in the authentication), I found a post where it tells me that the configuration of oauth 2.0 are sent in the body and you place the respective headers. So I do the post:

public autenticar(usuario:any) {

let uriUsuario:string = "http://uriLogin";

let data = JSON.stringify(usuario);

let headers = new Headers(
  {
    'Content-Type':'application/x-www-form-urlencoded',
    'Accept':'application/json'
  }
);  

this.http.post(uriUsuario, data, {headers: headers}).subscribe(res => {
  this.router.navigate(['/dashboard/main']);
}, error => {
  console.log(error.text());
})

}

The literal error is:

{"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}

Any suggestions?

    
asked by Edwin Fernando 13.04.2018 в 17:33
source

0 answers