I'm trying to implement the daemon authentication flow. The following post request returns me an access token with the right scope:
p_url = 'https://login.microsoftonline.com/' + 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' + '/oauth2/token'
data = { 'grant_type':'client_credentials',
'client_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'client_secret': 'L------------------------------------------=',
'resource':'https://analysis.windows.net/powerbi/api' }
r = requests.post(url=p_url, data=data)
I receive the following response
{
"access_token" : "ey------------"
"expires_on" : "1454857253",
"not_before" : "1454853353",
"expires_in" : "3600",
"token_type" : "Bearer",
"scope" : "Dashboard.Read.All Data.Alter_Any Dataset.Read.All Dataset.ReadWrite.All Report.Read.All",
"resource" : "https://analysis.windows.net/powerbi/api"
}
response = json.loads(r.text)
token = response['access_token']
headers = { 'Authorization': 'Bearer ' + token }
response = requests.get('https://api.powerbi.com/v1.0/myorg/datasets', headers=headers)
I use the endpoint from the applications "view endpoints" page. However, when I attempt to get list of "datasets" I always receive 403. What might be missing from the acquire token process?