2017-11-06 3 views
-4

Inside my logincomponentWinkel 2/4: 405 (Methode nicht erlaubt)

this.authenticationService.login('user', 'password').subscribe(comments => { 
     alert('success'); 
    }); 

Inside my AuthService:

login(username: string, password: string) { 
     let headers = new Headers({ 'Content-Type': 'application/json' }); 
     let options = new RequestOptions({ headers: headers }); 
     let url = 'http://22.5.66.58/api/v1/Identity/Login'; 
     console.log(this.data); 
     return this.http.post(url, this.data, options).map((res: Response) => res.json()); 

} 

Antwort

1

Es ist wie Ihre api Route sieht nicht POST Methode erlaubt, aber vielleicht nur GET oder PUT. Sie müssen auf der API (Server) -Seite beheben.

0

Das Problem ist in Ihrem Backend-Seite Ich nehme an, dass Sie Ihre Anfrage nicht akzeptieren POST-Anfrage.

Verwandte Themen