Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am trying to embed the Powerbi report in a web application. As the initial step I am trying to generate the access token to embed.
As specified, I need to invoke a REST API for "Request an authorization code" as mentioned in the article
In Restlet (Google Chrome Browser) I gave the following api url and the parameters using Get method request.
https://login.microsoftonline.com/common/oauth2/authorize? client_id=bee215ce-***********-029dc0351a1e &response_type=code &redirect_uri=http://localhost/12345 &response_mode=query &resource=https://service.contoso.com/ &state=12345
The Response object which I recevied is as below, but as per the article I am supposed to recevie the auth code which in turn I am supposed to use to get the access token. But the response object which I am receving back is not in the expected format.
I am not sure what is the mistake I am doing it here? any ideas? How to generate the authorization code and then the access token?
Solved! Go to Solution.
Hi,
Have you checked the following article?
How To: Get embed token using Get/Post only
The call to generate Access Token should be
"
POST: https://login.microsoftonline.com/common/oauth2/token
data: {
grant_type: password
scope: openid
resource: https://analysis.windows.net/powerbi/api
client_id: {Client ID}
username: {PBI Account Username}
password: {PBI Account Username}
}
--Returns Json:
{
"token_type": "Bearer",
"scope": "Report.Read.All ...",
"expires_in": "xxxx",
"ext_expires_in": "0",
"expires_on": "xxxxxxxxxx",
"not_before": "xxxxxxxxxxx",
"resource": "https://analysis.windows.net/powerbi/api",
"access_token": "eyJ0eXAi...",
"refresh_token": "AQABA...",
"id_token": "eyJ...."
}"
The resource should be
https://analysis.windows.net/powerbi/api
Make sure you have specified the other data part correctly.
for the process, please also check the document below:
Step 2: Get n authentication access token
Regards,
Michael
Hi,
Have you checked the following article?
How To: Get embed token using Get/Post only
The call to generate Access Token should be
"
POST: https://login.microsoftonline.com/common/oauth2/token
data: {
grant_type: password
scope: openid
resource: https://analysis.windows.net/powerbi/api
client_id: {Client ID}
username: {PBI Account Username}
password: {PBI Account Username}
}
--Returns Json:
{
"token_type": "Bearer",
"scope": "Report.Read.All ...",
"expires_in": "xxxx",
"ext_expires_in": "0",
"expires_on": "xxxxxxxxxx",
"not_before": "xxxxxxxxxxx",
"resource": "https://analysis.windows.net/powerbi/api",
"access_token": "eyJ0eXAi...",
"refresh_token": "AQABA...",
"id_token": "eyJ...."
}"
The resource should be
https://analysis.windows.net/powerbi/api
Make sure you have specified the other data part correctly.
for the process, please also check the document below:
Step 2: Get n authentication access token
Regards,
Michael
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |