0
votes

my service is:

 getToken(){
    var data = "grant_type=password&username=" + "username" + "&password=" + "yTX7W0s1zYxbJJT3+pXtJA==";

return this.http.post<any>('http://localhost:51643/token', data).pipe(map(res =>res))
}

for this example I use username e password static and in my componet

constructor(private data: PostaserviceService) { }
  ngOnInit() {  
     this.data.getToken().pipe().subscribe(res => {
      console.log(res);
    });
}

I have this error : POST http://localhost:51643/token 400 (Bad Request) ERROR HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "Bad Request", url: "http://localhost:51643/token", ok: false, …}

1
Any logs in ASP.NET about the 400? - Rup

1 Answers

1
votes

I solved the problem was that I can't pass the special characters ==