I am using Angular 8, microsoft-adal-angular6 package for Login and ngx-powerbi package to embed Powerbi report
I have created Azure App Registration and given the Powerbi API permissions
I am using the below configurations for Azure AD login
{
tenant: 'my tenant id',
clientId: 'my client id',
redirectUri: 'http://localhost:4200',
navigateToLoginRequestUrl: false,
cacheLocation: 'localStorage',
postLogoutRedirectUri: 'http://localhost:4200',
tokenUrl: 'https://graph.microsoft.com',
resource: 'https://analysis.windows.net/powerbi/api',
expireOffsetSeconds: 15 * 60
}
And I try to embed the powerbi report using the below code
<ngx-powerbi-component
type="report"
id="my-report-id"
embedUrl="https://app.powerbi.com/reportEmbed?reportId=my-report-id&groupId=my-group-id"
tokenType="Aad"
[accessToken]="token from ADAL"
></ngx-powerbi-component>
I have enabled service principal access in powerbi side
If I generate AD token from Postman with
GET https://login.microsoftonline.com/vca.com/oauth2/token
grant_type=password&client_id=[my_client_id]&client_secret=[my_client_secret]&resource=https://analysis.windows.net/powerbi/api&username=[username]&password=[password]
and use the response token in the ngx-powerbi-component, I am able to view the report.
I am not able to figure out how to generate correct AD token from MS ADAL.