I'm trying to use the Power BI REST API to embed some reports on my site. To do this using an access token acquired by "client credentials" method, but all the requests I'm doing the API denies by 403 codes.
I'm using PHP with curl, but to make it more readable I'll provide samples using curl client.
Get Access Token Code:
curl -X POST "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "client_id=4dd507e4-XXXX-XXX-8410-ce6853edf48a" -F "client_secret=i/0YIhvBa(...)/Y%3D" -F "grant_type=client_credentials" "https://login.microsoftonline.com/$myorg/oauth2/token"
API Call (Get Reports for example):
curl -X GET -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLC(...)4QzVw" "Cache-Control: no-cache" "https://api.powerbi.com/v1.0/myorg/reports"
It should follow this flow:
+---------+ +---------------+
: : : :
: :>-- A - Client Authentication --->: Authorization :
: Client : : Server :
: :<-- B ---- Access Token ---------<: :
: : : :
+---------+ +---------------+
PS: I found a similar question but this one isn't on same scope, language and append username and password isn't an option because isn't a personal application.
Attachement: https://powerbi.microsoft.com/en-us/documentation/