Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Impersonation Throws a "Bad Request" at Me Now

Not long ago, I was able to generate a token for the report embed with the following parameters:

 

 

This allowed me to use the user to filter the report based on the row-level security settings. For some reason, today this now throws a "Bad Request" endpoint error at me.

 

The odd thing is that the request goes through just fine if I omit the impersonation. It works just fine if I simplify the code to:

var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

However, this obviously doesn't help me with my row-level security issue.

 

Is anyone aware of any recent endpoint changes for spoofing an identity? Am I missing some information on the EffectiveIdentity instance?

 


  • Anonymous wrote:

    Not long ago, I was able to generate a token for the report embed with the following parameters:

     

     

    This allowed me to use the user to filter the report based on the row-level security settings. For some reason, today this now throws a "Bad Request" endpoint error at me.

     

    The odd thing is that the request goes through just fine if I omit the impersonation. It works just fine if I simplify the code to:

    var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

    However, this obviously doesn't help me with my row-level security issue.

     

    Is anyone aware of any recent endpoint changes for spoofing an identity? Am I missing some information on the EffectiveIdentity instance?

     


    Anonymous

    It actually works in my test. The reason for bad request might be RLS is not applied for that dataset, the datasetId is incorrect for the embedding report etc.

     

    In your case, I'd suggest you test calling the API GenerateToken in Postman or add try..catch block in your code to get the specific error message from the bad request.

    try
                    {
                        generatetoken()
                    }
    catch (HttpOperationException ex)
                   { 
                        //Bad Request
                        var content = ex.Response.Content;
                        Console.WriteLine(content); 
                    }

3 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    Anonymous wrote:

    Not long ago, I was able to generate a token for the report embed with the following parameters:

     

     

    This allowed me to use the user to filter the report based on the row-level security settings. For some reason, today this now throws a "Bad Request" endpoint error at me.

     

    The odd thing is that the request goes through just fine if I omit the impersonation. It works just fine if I simplify the code to:

    var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

    However, this obviously doesn't help me with my row-level security issue.

     

    Is anyone aware of any recent endpoint changes for spoofing an identity? Am I missing some information on the EffectiveIdentity instance?

     


    Anonymous

    It actually works in my test. The reason for bad request might be RLS is not applied for that dataset, the datasetId is incorrect for the embedding report etc.

     

    In your case, I'd suggest you test calling the API GenerateToken in Postman or add try..catch block in your code to get the specific error message from the bad request.

    try
                    {
                        generatetoken()
                    }
    catch (HttpOperationException ex)
                   { 
                        //Bad Request
                        var content = ex.Response.Content;
                        Console.WriteLine(content); 
                    }
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks, Eric_Zhang. I'll doublecheck everything and see if I can get the specific error message, and report back with my findings.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Well, I'm not sure what was wrong before, but it's working now. I didn't actually change anything other than adding the try/catch block, but the request went through anyway. Either way, it's good advice, and I'll log those so I can figure out what's going wrong if it happens again.