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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vickyprudhvi
Helper IV
Helper IV

Validate Power BI Embed Token

HI

I was able to create Embedded Toekn using powerbi create-embed-token Script method using Command Prompt.

I would like to decode this token and validate it. Is there any way of doing it because When I use this token in HTML script.

I am getting error. It says The Content isn't available.

Pls Help

 

 

Thanks,

Raj

2 ACCEPTED SOLUTIONS


@vickyprudhvi wrote:

Hi @Eric_Zhang

Thank you for your reply. I am able to validate using below site but wen I use username and role in the token it is throwing error.

Below is the script I am using to generate token. But not working. Any thoughts

var token2 = '{"ver":"0.2.0","wcn":"' + workspaceCollectionName + '","wid": "' + workspaceId + '","rid":"' + reportId + '","iss":"PowerBISDK","aud":"https://analysis.windows.net/powerbi/api","exp":' + exp + ',"nbf":' + nbf + '","roles": "' + roles + '","username": "' + username + '"}'

 


@vickyprudhvi

I'm not sure if that way to concat the token is valid or not, could you share me any documentation explaining that way to generate a token. I'm more used to Microsoft.PowerBI.Api in this demo in github,  When role and user name needed, I generate a token this way.

 

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,"username",new string[] { "role1", "role2", "role3" });

View solution in original post


@vickyprudhvi wrote:

Hi @Eric_Zhang

As you should have heard regarding new changes with respect to embedding. Now that Azure and PowerBI services are combined. I would like to know how to create embed token with RLS in the new concept. Before we were able to create embed token but today;s world embed token is created in PowerBi Services ( Report ID, Group ID, Aurthentication Code). Is there a way to create embed token in our side. I belive the new embed token is not JWT format.


@vickyprudhvi

For the new Embedding with non-Power BI users, I got the confirmation that the RLS is on the roadmap and will be available in next quarter. So you may not apply RLS for the new concept at this moment.

 

No, it is no longer JWT format, the' embed token is encrypted in the new concept.

View solution in original post

8 REPLIES 8
Eric_Zhang
Employee
Employee


@vickyprudhvi wrote:

HI

I was able to create Embedded Toekn using powerbi create-embed-token Script method using Command Prompt.

I would like to decode this token and validate it. Is there any way of doing it because When I use this token in HTML script.

I am getting error. It says The Content isn't available.

Pls Help

 

 

Thanks,

Raj


Usually the error "the content isn't available" is due to the token expiration, if  the token was generated correctly. You can decode the token following below steps.

 

  1. Go to https://jwt.io/ , paste your token to the left panel.
    Capture.PNG
  2. You'll find an "exp" field in the decoded JSON, copy that number "149xxxxxx".
  3. Go to epochconverter and paste the number, then you'll get  the expiring date.
    Capture.PNG

By the way, instead of Power BI - CLI(I guess this tool in your case, as you mentioned create-embed-token), you can generate the token every time when embedding in a programming way. Though it is not recommended, you can even generate a token that never expires by changing the official demo code.

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,Convert.ToDateTime("2099-12-31"));

Hi @Eric_Zhang

Thank you for your reply. I am able to validate using below site but wen I use username and role in the token it is throwing error.

Below is the script I am using to generate token. But not working. Any thoughts

var token2 = '{"ver":"0.2.0","wcn":"' + workspaceCollectionName + '","wid": "' + workspaceId + '","rid":"' + reportId + '","iss":"PowerBISDK","aud":"https://analysis.windows.net/powerbi/api","exp":' + exp + ',"nbf":' + nbf + '","roles": "' + roles + '","username": "' + username + '"}'

 

@vickyprudhvi

How are things going on there?

Hello there,


I need to generate a token for embedding power bi report, but i am not using power bi embed for this and I wont be performing authorization. 

since its not power bi embed,

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,"username",new string[] { "role1", "role2", "role3" });

isnt helping.

 

how do i go abt this, I got the embed url for the report but a valid access token is a must.

Hi @Eric_Zhang

As you should have heard regarding new changes with respect to embedding. Now that Azure and PowerBI services are combined. I would like to know how to create embed token with RLS in the new concept. Before we were able to create embed token but today;s world embed token is created in PowerBi Services ( Report ID, Group ID, Aurthentication Code). Is there a way to create embed token in our side. I belive the new embed token is not JWT format.


@vickyprudhvi wrote:

Hi @Eric_Zhang

As you should have heard regarding new changes with respect to embedding. Now that Azure and PowerBI services are combined. I would like to know how to create embed token with RLS in the new concept. Before we were able to create embed token but today;s world embed token is created in PowerBi Services ( Report ID, Group ID, Aurthentication Code). Is there a way to create embed token in our side. I belive the new embed token is not JWT format.


@vickyprudhvi

For the new Embedding with non-Power BI users, I got the confirmation that the RLS is on the roadmap and will be available in next quarter. So you may not apply RLS for the new concept at this moment.

 

No, it is no longer JWT format, the' embed token is encrypted in the new concept.

Hi Eric

How to check the claims now?


@vickyprudhvi wrote:

Hi @Eric_Zhang

Thank you for your reply. I am able to validate using below site but wen I use username and role in the token it is throwing error.

Below is the script I am using to generate token. But not working. Any thoughts

var token2 = '{"ver":"0.2.0","wcn":"' + workspaceCollectionName + '","wid": "' + workspaceId + '","rid":"' + reportId + '","iss":"PowerBISDK","aud":"https://analysis.windows.net/powerbi/api","exp":' + exp + ',"nbf":' + nbf + '","roles": "' + roles + '","username": "' + username + '"}'

 


@vickyprudhvi

I'm not sure if that way to concat the token is valid or not, could you share me any documentation explaining that way to generate a token. I'm more used to Microsoft.PowerBI.Api in this demo in github,  When role and user name needed, I generate a token this way.

 

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,"username",new string[] { "role1", "role2", "role3" });

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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