I am working on an Angular app in which we have to show PowerBI reports. The user will select organization from a dropdown and the page should show PowerBI report for the selected organization. We have all the required information for each of the oraganization (ClientId, TenantId, Client Secret).
I have done most of the settings, however stuck at getting the right token (the token I am getting gives 401 error).
Here is my Postman setup to get token: (URL: https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token)
As you can see I am getting token. However, for the report specific API (To get EmbedURL) I am getting 401: (URL: https://api.powerbi.com/v1.0/myorg/groups/{groupid}/reports/{reportId})
Further, if I copy and paste token from https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-reports-in-group#code-try-0 then it works and I am getting all the info I need. Here is what I mean:
Am I missing something? I am fairly sure that this is something to do with scope. Which scope being used in the example page by Microsoft? Any idea/way to figure this out?
I also gave correct API permissions in the Azure portal: