Showing results for 
Search instead for 
Did you mean: 
Zuv Frequent Visitor
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 Team
Community Support Team

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

Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 63 members 1,303 guests
Please welcome our newest community members: