Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JacobBa
New Member

Can not get Access Token to use with PowerBI API

Hello, 

I am having trouble with trying to generate an access token for PowerBI JavaScript API in an app-owns-data scenario. 

Following the example, I got the whole process working (with a new, custom tenant as said by the instructions).

 

Now, I need to move it onto the real tenant that it is being implemented on. However, when I try to get a token like before, it spits out an error saying that my username or password is incorrect, when I know for sure that it is not. 

 

Here's an example of the code I'm using to query for one: 

 

 

 

var settings = {

    "url": "https://login.microsoftonline.com/common/oauth2/token",

    "method": "POST",

    "headers": { "Content-Type": "application/x-www-form-urlencoded" }

}

 

settings['data'] = "resource=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi&client_id=(azurenativeapiapplicationid)&grant_type=password&username=fake@fake.com.au&password=notrealpassword&scope=openid";

 

$.ajax(settings).done(function(result){console.log(result)});

 

 

 

0 REPLIES 0

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.