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

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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