Reputation: 49
I'm embedding the Microsoft Power BI Q&A but getting error on console below are the attached screenshot for embed configuration and error.
embed configuration and error
I followed the https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html# link for embedding the Q&A but getting error.
Upvotes: 0
Views: 1108
Reputation: 49
After a lot of analysis, I found the answer.
Body:-
{
"accessLevel": "view"
}
Response:- {
"@odata.context":"http://api.powerbi.com/v1.0/myorg/groups/your_group_id/$met...GenerateTokenResponse",
"token":"H4sI........A=",
"tokenId":"951b6385-d004-42e4-84a1-e45d904bfca0",
"expiration":"2018-05-10T08:08:33Z"
}
Embed Configuration:-
var embedUrl = 'https://app.powerbi.com/qnaEmbed?groupId=your_group_id';
var config = {
type : 'qna',
tokenType : models.TokenType.Embed,
accessToken : token, // from the above api call
embedUrl: ,
datasetIds: datasetIds,
viewMode : 0, // 0 = Interactive , 1 = readonly
question: your_question
};`
Get the reference of html element where you want to embed Q&A chart.
var qnaContainer = $('#qnaContainer');
Embed the QNA and display it within the div container
var qna = powerbi.embed(qnaContainer, config);
Upvotes: 2
Reputation: 1391
tokenType = 1
in your config suggests EmbedToken which is generated via /GenerateToken API call.
try either changing tokenType to 0 (TokenType.Aad) or retrieving this token using:
https://msdn.microsoft.com/en-us/library/mt784614.aspx
or this tutorial: https://guyinacube.com/2017/09/get-embed-token-power-bi-dashboards-reports/
Upvotes: 1