【发布时间】:2016-09-25 01:20:15
【问题描述】:
我的 http 调用返回 200,但未捕获任何响应。 我在订阅中的代码没有被命中。当我在邮递员中测试时,API 正在返回数据。这是我的代码。
getToken(authcode: string) {
var data = 'client_id=InspectWebApp_client&code=' + authcode + '&redirect_uri=http://localhost:3000&grant_type=authorization_code';
let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
let options = new RequestOptions({ headers: headers });
this.http.post('https://fedloginqa.test.com/as/token.oauth2', data, options)
.subscribe((res: Response) => {
var resultsToken = res.json();
localStorage.setItem("access_token",resultsToken.access_token)
//return this.inspections;
})
}
【问题讨论】:
标签: rest angular angular2-http