The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi,
I am trying to call the PowerBi APIs using the PowerBI JS library.
I am successful in generating the id token and even go one step ahead and use the ADAL.acquireToken method to get an access token.
Post this, I try to access the APIs as mentioned in the documents.
However, I get a 403 with no details in the error object at all.
Stringify-ing the error shows the following:
Error{"readyState":4,"responseText":"","status":403,"statusText":"Forbidden"}
I have the correct tenant and all the permissions granted to the App that I registered in Azure.
What should I be doing/what could be wrong in this case?
Can someone please help!
Here are similat links you could refer to
How to Generate Embed Token in pure JavaScript
Best Regards
Maggie
Thanks Maggie !
I had gone through these links before posting. They do not address specifically the scenario I am facing.
I am still stuck with this problem and would appreciate any help.
Just to clarify a few more things, I am using the PowerBI JS module installed through npm.
My current code looks like the following:
function userSignedIn(err, token) { if (!err) { var cachedToken = ADAL.getCachedToken(appid); if (!cachedToken) { ADAL.acquireToken("https://analysis.windows.net/powerbi/api", function(error, token) { // Handle ADAL Error if (error || !token) { console.log('ADAL Error Occurred: ' + error); return; } else { cachedToken = token; console.log("Acquired access token..."); } }); } if (cachedToken) { console.log('Token' + cachedToken); $.ajax({ type: "GET", url: "https://api.powerbi.com/v1.0/myorg/availableFeatures",//"dashboards", headers: { 'Authorization': 'Bearer ' + cachedToken } }).done(function(data) { console.log(data); }).fail(function(err) { console.log('Error' + JSON.stringify(err) ); }).always(function() {}); }; }; }
User | Count |
---|---|
59 | |
57 | |
55 | |
50 | |
32 |
User | Count |
---|---|
171 | |
87 | |
70 | |
46 | |
45 |