Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
pbimdland
Regular Visitor

Embed Token API Error: Creating embed token with multiple identities is not supported

Hello everyone,

 

I am creating a dashboard in a web application via App Owns Data. I am able to follow this guide and embed my dashboard to the web application: https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers

 

Also, I am trying to implement Row-Level Security via the REST API as mentioned in this guide: https://docs.microsoft.com/en-us/power-bi/developer/embedded-row-level-security

 

However, the REST API gives me the following error message as the response:

 

 

{'error': {'code': 'InvalidRequest', 'message': 'Creating embed token with multiple identities is not supported'}}

 

 

I am using almost the same payload (see below) as the one mentioned in the guide, and if I comment-out identities, I get the embed token as normal.

 

{
    "accessLevel": "View",
    "identities": [
        {
            "username": "EffectiveIdentity",
            "roles": [ "Role1", "Role2" ],
            "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ]
        }
    ]
}

 

 

Any ideas why I'm getting this error message? Thanks.

 

2 REPLIES 2
jayvandenbos
Frequent Visitor

Hi,

 

I got the same error and contacted the Microsoft Power BI support team and they helped me out. Turns out there was something wrong with my request.

 

I'm creating an App owns data web application in Python Django and this is what works for me. 

import requests
import json

username = '...'
password = '...'
client_id = '...'
report_id = '...'
group_id = '...'
dataset_id = '...'
settings = {
            "accessLevel": "View",
            "identities": [
                {
                "username": "Andrew Ma",
                "roles": [ "Manager" ],
                "datasets": [ dataset_id ]
                }
            ]
        }

data = {
    'grant_type': 'password',
    'scope': 'openid',
    'resource': r'https://analysis.windows.net/powerbi/api',
    'client_id': client_id,
    'username': username,
    'password': password
}
# Get access token
response = requests.post('https://login.microsoftonline.com/common/oauth2/token', data=data)
print(response.content)
access_token = response.json().get('access_token')

# Get embed token
dest = 'https://api.powerbi.com/v1.0/myorg/groups/' + group_id \
    + '/reports/' + report_id + '/GenerateToken'
embed_url = 'https://app.powerbi.com/reportEmbed?reportId=' \
    + report_id + '&groupId=' + group_id
headers = {'Authorization': 'Bearer ' + access_token, 'Content-Type': 'application/json'}
response = requests.post(dest, json=settings, headers=headers)
print(response.content)
embed_token = response.json().get('token')
print(embed_token)

Turns out I forgot to add the Content-Type: application/json to the request headers. Also, my settings weren't formatted as json in the request.

 

Hope this helps you out.

 

Regards

pbimdland
Regular Visitor

Nobody at Microsoft knows what this error means?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors