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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kiran_subhedar
Regular Visitor

QnA Embedding

Hello,

I am following the online QnA example at https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html to embed QnA into a asp.net mvc intranet portal. I am using exactly the same code although modifying the values for embed token, embed url, and dataset id. But all i get in the embededded frame is as below. There aren't any errors in the browser console either. I am getting the access token by following the article at https://docs.microsoft.com/en-us/power-bi/developer/get-azuread-access-token. The intranet portal is internal to Microsoft. Any ideas why this is not working?qna.PNG

 

 

 

1 ACCEPTED SOLUTION

I finally got it working by specifying tokenType as models.TokenType.Aad instead of models.TokenType.Embed. 

var config = {
type: 'qna',
tokenType: models.TokenType.Aad,
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
datasetIds: [txtDatasetId],
viewMode: models.QnaMode.Interactive,
question: txtQuestion
};

View solution in original post

4 REPLIES 4
Eric_Zhang
Employee
Employee


@kiran_subhedar wrote:

Hello,

I am following the online QnA example at https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html to embed QnA into a asp.net mvc intranet portal. I am using exactly the same code although modifying the values for embed token, embed url, and dataset id. But all i get in the embededded frame is as below. There aren't any errors in the browser console either. I am getting the access token by following the article at https://docs.microsoft.com/en-us/power-bi/developer/get-azuread-access-token. The intranet portal is internal to Microsoft. Any ideas why this is not working?qna.PNG

 

 

 


@kiran_subhedar

In embedding scenarios, embedded token starting with H4sIxxx.. is required, instead of an access token. You can get the embedded token with the access token by calling GenerateToken, see Generate token for Q&A

I finally got it working by specifying tokenType as models.TokenType.Aad instead of models.TokenType.Embed. 

var config = {
type: 'qna',
tokenType: models.TokenType.Aad,
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
datasetIds: [txtDatasetId],
viewMode: models.QnaMode.Interactive,
question: txtQuestion
};


@kiran_subhedar wrote:

I finally got it working by specifying tokenType as models.TokenType.Aad instead of models.TokenType.Embed. 

var config = {
type: 'qna',
tokenType: models.TokenType.Aad,
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
datasetIds: [txtDatasetId],
viewMode: models.QnaMode.Interactive,
question: txtQuestion
};


@kiran_subhedar

I'd suggest using "tokenType: models.TokenType.Embed", the main concern is that the models.TokenType.Aad would have more security risk. The access token would be plaintext in your web page, with the access token anyone can access all reports, dashboards, datasets etc via REST API, while using embedded token which is specific for the embedded objects has narrowed-down access permissions. Meanwhile For feature Row Level Security in Embedding for your customers scenario, you'll have to use embed token.

@Eric_Zhang, actually I did tried to use the guidelines mentioned on page GenerateToken (Generate token for Q&A), and tried to mimic the example on the page to get a token for Q&A but received a Forbidden error. I think that this code meant to be used for Embedding for Customers, where in our website we are embedding for an organization, for which the method of generating a token is different, hence I used the token type as AaD. Moreover, do I need to generate a separate token for Q&A, in addition to the AaD token?

 

Thanks,

Kiran

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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