Reply
Zuv Frequent Visitor
Frequent Visitor
Posts: 13
Registered: ‎04-26-2016

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

[ Edited ]

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);
})
Highlighted
Community Support Team
Posts: 4,051
Registered: ‎07-09-2016

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

@Zuv, After taking a look at powerBIToken.ts(https://github.com/Microsoft/PowerBI-Node/blob/f9e00fdea65b55d2ccc5c7ffcc8b36bbaab0c3ea/lib/core/pow...), 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.