【发布时间】:2019-10-22 07:12:12
【问题描述】:
我在邮递员中调用 power bi API,它运行良好,并且作为我得到的公认结果。 当我在角度应用程序中调用该应用程序时,它不起作用。 我的响应为空。
我在下面附上了我的代码, 请帮帮我,我最近几天一直在尝试解决这个问题。
API: https://login.microsoftonline.com/common/oauth2/token
下面是我的角码
getAccessToken(param): Observable<any> {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
})
};
const body = new HttpParams()
.set('resource', 'https://analysis.windows.net/powerbi/api')
.set('client_id', 'xxxxxxxxx')
.set('client_secret', 'xxxxxxxxx')
.set('grant_type', 'password')
.set('scope', 'openid')
.set('username', 'xxxxxxxxx')
.set('password', 'xxxxxxxxx');
return this.http.post("https://login.microsoftonline.com/common/oauth2/token", body.toString(), httpOptions)
.pipe(
map(response => response)
);}
在下面的参考图像中,相同的 API 运行良好,但在 Angular 中无法运行。
【问题讨论】:
标签: angular http-post powerbi postman powerbi-embedded