Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Is it possible to pass username and roles with powerbi-node api?

I am happily using powerbi node api for getting reports, datasets, for uploauding reports etc.

But seems like it doesn't work with RLS and powerbi-node?

I am trying to pass user and roles and get correct token, but visuals are not displayed at all, getting error like - visual can not be displayed.. Dashboards without RLS works perfect using this method.

Maybe I am doing something wrong, here is code snippet I am using:

app.get ('/jwt/:collection/:workspaceid/:report_id/:user/:role', function(req,res) {
      var param = req.params;
      var token = powerbi.PowerBIToken.createReportEmbedToken(param.collection, param.workspaceid, param.report_id, param.user, param.role);
      var jwt = token.generate('fubar');
      res.send (jwt);
Community Support
Community Support

Re: Is it possible to pass username and roles with powerbi-node api?

@Zuv, After taking a look at powerBIToken.ts(, I find that you need to specify parameter datasetId and scopes as well.
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.