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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
rajaniesh
Helper II
Helper II

Nodejs powerbi Get Token Request failing with AADSTS7000218

Hi,

I am using the sample provided at https://github.com/microsoft/PowerBI-Node and use the correct application ID along with the below config defined in the Jason config file.

 

{

"authorityUrl" : "https://login.microsoftonline.com/common/",

"resourceUrl" : "https://analysis.windows.net/powerbi/api",

"apiUrl" : "https://api.powerbi.com/",

"appId" : "",

"workspaceId" : "",

"reportId" : "",

"username" : "",

"password" : ""

}

 

But when this methid from the sample code given below

 

But when this method is called 


    // use user credentials and appId to get an aad token
    let promise = () => { return new Promise(
        (resolve, reject) => {
            context.acquireTokenWithUsernamePassword(config.resourceUrl, config.username, config.password, config.appId , function(err, tokenResponse) {
                if (err) reject(err);
                resolve(tokenResponse);
            })
        });
    };

 

then It throw this error.

Get Token request returned http error: 401 and server response: {"error":"invalid_client","error_description":"AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.\r\nTrace ID: 6560c4b9-fe40-4120-ab2a-921956300000\r\nCorrelation ID: fd7fb0dd-e345-4206-b426-d121000f7393\r\nTimestamp: 2019-08-02 19:14:41Z","error_codes":[7000218],"timestamp":"2019-08-02 19:14:41Z","trace_id":"6560c4b9-fe40-4120-ab2a-921956300000","correlation_id":"fd7fb0dd-e345-4206-b426-d121000f7393"}

 

I do not understand why it is asking for client Secret because there is no option provided in this to specific client secret.

Not sure where I need to specify that . Not sure How can we make this sample work. I have use Azure Portal to register the App and assigning permission to PowerBI but that also did not worked and throwing the same error.

 

Any help would be really appreciated.

 

Regards

Rajaniesh

3 REPLIES 3
u02cm62
Helper V
Helper V

you get the secret when you register it as an Azure Web app (API/Web app Type).  If you registered as "Native" type, then there is no client secret.  https://dev.powerbi.com/apps

 

This basically registers it properly inside Azure portal for you, must easier than missing something in Azure Portal in my opinion, although, good to know how to properly do it yourself anyway as background info.

Also, you need to provide these values.  You get workspace ID from getting it in app.powerbi.com when navigating to the workspace, it provides the GUID in the url there.  You get the report ID by navigating to app.powerbi.com and clicking the report from the workspace, then in the url, the report guid will show up.  The username and password is the one who is registering it, and we always use a service account aka master user in the documentation or service principal (newer way recently if working with V2 of the workspaces).  Anything new for workspaces is V2.

"appId" : "",

"workspaceId" : "",

"reportId" : "",

"username" : "",

"password" : ""

Even after providing these values in the config file and registering the app it is not working.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors