Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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); });
User | Count |
---|---|
16 | |
5 | |
2 | |
1 | |
1 |
User | Count |
---|---|
22 | |
3 | |
3 | |
2 | |
1 |