microsoft / PowerBI-Node

Node SDK and client library for Power BI REST APIs.
https://dev.powerbi.com
Other
79 stars 27 forks source link

Cannot authenticate Using the JWT received from Node #39

Open qwalker120 opened 7 years ago

qwalker120 commented 7 years ago

I am using this method to acquire a jwt. When I use this method, I test out the token here:

https://microsoft.github.io/PowerBI-JavaScript/demo/code-demo/index.html#

Yet when I use the token I get a "Not Authorized" and the PowerBI report will not show. I can use the ProvisionSample C# CLI provided here: https://github.com/Azure-Samples/power-bi-embedded-integrate-report-into-web-app/tree/master/ProvisionSample Everything will work fine when I use this method and I am able to get report to render. When I use the ProvisionSample, I am logged into visual studio 2015. I have tried to run node code in visual studio while signed in as well as outside authenticated environment. Am I doing something wrong with the request? Please help. Thank you

var powerbi = require('powerbi-api');

var token = powerbi.PowerBIToken.createReportEmbedToken(workspaceCollectionName = 'wcn' , workspaceId = 'wid' , reportId = 'rid' , did = '' , scp = 'Report.Read' , username = 'user' , roles = '' , expiration = new Date(2905804496111));//'2062-01-29T23:54:56.111Z'

console.log("Token: ", token);

var jwt = token.generate(process.env.pbiAccessKey);

console.log("JWT: ", jwt);