Forum Discussion
Embedding report in external app with non-Power BI users
- 9 years ago
1. The registered Azure APP doesn't have anything to do with Power BI reports except to get the accesstoken. If you want to embed your reports in an external application you have to publish it to PowerBI service,
2.You could get the accesstoke and embedded token via two REST APIs as below.
--get the access token POST /common/oauth2/token HTTP/1.1 Host: login.windows.net Cache-Control: no-cache Content-Type: application/x-www-form-urlencoded client_id=49dxxxxxxxthe register app client idxxxxx0-6d93f770d1a4&grant_type=password&resource=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi&username=yourpowerbiaccount&password=yourpowerbipassword
--To get the embedded token for a report/dashboard/tile
--reference https://msdn.microsoft.com/en-us/library/mt784614.aspx
POST /v1.0/myorg/groups/dc5811-YOURGROUPID-f16b6c15/reports/16d21d5a-YOURreportID--46a2fd9/GenerateToken HTTP/1.1
Host: api.powerbi.com
Content-Type: application/json
Authorization: Bearer theTokenFromPriorAPI
Cache-Control: no-cache
{
"accessLevel": "View"
}3. Yes, it needs a Premium licence if you want to use Embedding with non-Power BI users (app owns data). For cost-saving, a more simpler approach would be using Publish to web, you don't have to apply option 1&2.
In this scenario why we're creating accessToken ? We will use only embedToken to embedding our reports ? If accessToken is necessery how we will use this token in app ?
Access Token is for quering API to which you have access. Embedded token is generated in API(when calling to generate embedded token you need to pass Access Token like to all restricted API) for just be able to embedded single dashboard or report.