Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hello All;
I have been trying for a while to get an embedded solution to work, as a proof of concept. But I am struggling with the Http requests.
This is trying to follow the "App owns data" "example".
https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers
I have created a Native application. I have given it the correct permissions, I used a global admin account, and I granted permissions within Azure Portal.
The following method works fine within PostMan (ie all the correct information is given). https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475
However it fails when I try to call the first request (/oauth2/token) with Javascript. All parameters are identical, I have double and triple checked them.
My code is as follows:
getAccessToken(Password): string{
const url = "https://login.windows.net/{tenantID}/oauth2/token";
const headers = new HttpHeaders( {
"Content-Type": "application/x-www-form-urlencoded"
});
const requestBody = {
"grant_type": "password",
"scope": "openid",
"resource": "https://analysis.windows.net/powerbi/api",
"client_id": this.getClientID(),
"username": this.getUsername(),
"password": Password
}
var accessTokenRequestReponse = this.httpClient.post(url, requestBody, {headers: headers}).subscribe(
(reponse) => {
console.log(reponse)
console.log(reponse['access_token'])
},
(error) => {console.log(error)}
)
return("");
}https://login.windows.net/{tenantID}/oauth2/v2.0/token
https://login.windows.net/common/oauth2/v2.0/token
https://login.windows.net/{tenantID}/oauth2/token
https://login.windows.net/common/oauth2/token
https://login.microsoftonline.com/common/oauth2/token
https://login.microsoftonline.com/{tenantID}/oauth2/tokenerror:"invalid_request"
error_codes:[90014]
error_description:"AADSTS90014: The request body must contain the following parameter: 'grant_type'.
↵Trace ID: c4ce24c7-{...}d00
↵Correlation ID: 21a2c8d0-{...}87
↵Timestamp: 2018-04-26 {...}"When I examine this in the Network section of chrome, I find that the call has "grant_type" in itAccept: application/json, text/plain, */* Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Connection: keep-alive Content-Length: 260 Content-Type: application/x-www-form-urlencoded Host: login.windows.net Origin: http://evil.com/ #Note this is from that chrome extenstion Referer: http://localhost:4200/powerBI User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
{
"grant_type":"password",
"scope":"openid",
"resource":"https://analysis.windows.net/powerbi/api",
"client_id":"{clientID}",
"username":"{username}@{tenant}.onmicrosoft.com",
"password":"{password}",
"tenant":"{tenant}.onmicrosoft.com"
}: I will do some further research on this part.
There might be some time delay before I could response with any helpful points.
Regards,
Michael
Thank you.
Any help is greatly appreicated.
Regards
Christy
Hi Christy,
Did you resolve your issue ?
Because we are stuck at the same point.
Many thanks for your help.
Nuno.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |