Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I've tried to understand how everything works, registering apps etc. Autheticating with ADAL etc.
If anyone knows step by step, or have a sample where some JavaScript works, it woudl be helpful
I am trying to build an angular 2 app (but it can be pure javascript as well) to, embed on a webpage.
From that app I want to call https://api.powerbi.com/v1.0/myorg/dashboards and auth with a token.
So since the app will be hosted at http://adress.com/somePage. Should I register an app with PowerBI, or not? Since I seem to need the clientId to get a token.
In this scenario I have logged in as myself and getting the cached token, to send to the API.
This is some code I've tried, just trying to call it from localhost, but I get a 403:
let token = this.adalService.getCachedToken(this.adalService.config.clientId); let headers = new Headers({ 'Authorization': 'Bearer ' + token, 'Accept': 'application/json', 'Content-Type': 'application/json; charset=utf-8', }); let options = new RequestOptions({ headers: headers }); return this.http.get(`https://api.powerbi.com/v1.0/myorg/dashboards`, options) .toPromise() .then((res) => { return res; }) .catch((e) => { console.error(e); });
@simonagren wrote:
I've tried to understand how everything works, registering apps etc. Autheticating with ADAL etc.
If anyone knows step by step, or have a sample where some JavaScript works, it woudl be helpful
I am trying to build an angular 2 app (but it can be pure javascript as well) to, embed on a webpage.
From that app I want to call https://api.powerbi.com/v1.0/myorg/dashboards and auth with a token.
So since the app will be hosted at http://adress.com/somePage. Should I register an app with PowerBI, or not? Since I seem to need the clientId to get a token.
Have you debugged the token value and try to call the dashboard API in some other API test console like postman?
As 403 indicates an unauthorization problem, so your question seems actually related to AAD authentication, I'd suggest you post it in the dedicated AAD forum. You'd get more proper response there.
You can also check this github lib azure-activedirectory-library-for-js.
After getting a valid token, we can help to call the Power REST APIs.
I've tried to understand how everything works, registering apps etc. Autheticating with ADAL etc.
If anyone knows step by step, or have a sample where some JavaScript works, it woudl be helpful
I am trying to build an angular 2 app (but it can be pure javascript as well) to, embed on a webpage.
From that app I want to call https://api.powerbi.com/v1.0/myorg/dashboards and auth with a token.
So since the app will be hosted at http://adress.com/somePage. Should I register an app with PowerBI, or not? Since I seem to need the clientId to get a token.
In this scenario I have logged in as myself and getting the cached token, to send to the API.
This is some code I've tried, just trying to call it from localhost, but I get a 403:
let token = this.adalService.getCachedToken(this.adalService.config.clientId); let headers = new Headers({ 'Authorization': 'Bearer ' + token, 'Accept': 'application/json', 'Content-Type': 'application/json; charset=utf-8', }); let options = new RequestOptions({ headers: headers }); return this.http.get(`https://api.powerbi.com/v1.0/myorg/dashboards`, options) .toPromise() .then((res) => { return res; }) .catch((e) => { console.error(e); });
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |