Forum Discussion
grant_type must be "password" and app level permissions
- 8 years ago
We use a service account that has access to PowerBI for this. We have MFA turned on almost all accounts, but off for service accounts.
It apears to be true that one needs the password grant type.
And for extra fun, the AAD library no longer supports it. "UserCredential" is no lnoger there.
So what you must do is issue a regular old HTTPS POST to the authority URL, and a body like this:
string authBody = $@" grant_type = password &resource ={WebUtility.UrlEncode(resourceString)} &username ={WebUtility.UrlEncode(username)} &password ={WebUtility.UrlEncode(password)} &client_id ={clientId} &client_secret={ WebUtility.UrlEncode(secret)}";With this information, becuase you're including a client secret, there will be no prompt necessary.
Good luck.
-e
We use a service account that has access to PowerBI for this. We have MFA turned on almost all accounts, but off for service accounts.
It apears to be true that one needs the password grant type.
And for extra fun, the AAD library no longer supports it. "UserCredential" is no lnoger there.
So what you must do is issue a regular old HTTPS POST to the authority URL, and a body like this:
string authBody = $@"
grant_type = password
&resource ={WebUtility.UrlEncode(resourceString)}
&username ={WebUtility.UrlEncode(username)}
&password ={WebUtility.UrlEncode(password)}
&client_id ={clientId}
&client_secret={ WebUtility.UrlEncode(secret)}";With this information, becuase you're including a client secret, there will be no prompt necessary.
Good luck.
-e
Can you elaborate Eric? I am possibly having the same issue. What do you mean by
"So what you must do is issue a regular old HTTPS POST to the authority URL"?