Forum Discussion

jarek_blaszczyk's avatar
jarek_blaszczyk
Regular Visitor
8 years ago
Solved

RLS doesn't work with identities from embed token (don't filter the report data)

Hi,

I use Power BI Embedded for display the report in the web application.
I receive correct embed token passing in the request body identities, like (values are just examples)
{
"accessLevel": "view",
"identities": [{
"username": "my_user@my_company",
"roles": ["my_role"],
"datasets": ["aaaaaaaa-0000-cccc-eeee-77777777777"]
}]
}
The problem is that RLS filtering is not working. The report is diplayed, but contains all data connected to the master account, no to "my_user@my_company" and "my_role".

The client on Power BI desktop uses the same username and role and the data is filtered. Which is the problem?
May I decode in some way the token or analize / verify it?

  • jarek_blaszczyk's avatar
    jarek_blaszczyk
    8 years ago

    Solved!
    The issue was tha bad key in post json: "identitites" instead of "identities".
    That bug was difficult to be discovered as the request gave back the correct response with the report token. But in the request body was taken only accessLevel and identities part has been ignored.

9 Replies

  • TriPax's avatar
    TriPax
    Frequent Visitor

    did you add this role also on the PBI report side?
    you need to create some custom role called for example my_role with parameters

    [column from your table with email] = username ()

      • TriPax's avatar
        TriPax
        Frequent Visitor

        I'm using it at my app so it's look like that on the raport side

        Then in the code I'm using 

        accessLevel: "view", identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "[email protected], roles: new List<string> { DynamicUser }, datasets: new List<string> { somedatasetid }) }

         

        But I'm using .net app so it should be sth like this if we use hardcoded values

        "accessLevel": "View", "identities": [ { "username": "[email protected]", "roles": [ "DynamicUser" ], "datasets": [ "somedatasetid" ] } ]