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.
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() {}); }; }; }
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |