Forum Discussion

MattMessina's avatar
MattMessina
New Member
4 years ago
Solved

Error 401 when attempting to switch embedded reports

Hello, I am attempting to embed several PowerBI reports onto the same page in my React application, both paginated and non-paginated.   I am using the "App owns data" method of embedding. We have a w...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi MattMessina ,

     

    Here I have some suggestions for you.

    1. There are two kinds of authentation method to App owns data, Master User Or Service Principal.

    When using a service principal for authentication, refer to Embed Power BI content with service principal and Considerations and limitations.

    When using Master User you need to check the API Permission.

    Required scope:

    All of the following, unless a requirement doesn't apply:

    • Content.Create, required if a target workspace is specified in GenerateTokenRequestV2.
    • Report.ReadWrite.All or Report.Read.All, required if a report is specified in GenerateTokenRequestV2.
    • Report.ReadWrite.All, required if the allowEdit flag is specified for at least one report in GenerateTokenRequestV2.
    • Dataset.ReadWrite.All or Dataset.Read.All

    2. Please check whether all workspace you get report from are new workspace.

    For reference: 

    • You can only create a report in workspaces specified by the targetWorkspaces parameter.
    • All reports and datasets must reside in a V2 workspace.
    • All target workspaces must be V2 workspaces.
    • Maximum 50 reports.
    • Maximum 50 datasets.
    • Maximum 50 target workspaces.
    • For Azure Analysis Services or Analysis Services on-premises live connection reports, generating an embed token with row-level security might not work for several minutes after a rebind

    3. To create an embed token for all reports by generate token option, you need to add all Dataset IDs and Report IDs you need in your code. You can have a test in post man. You will get 200 return if you succeed.

    {
      "datasets": [
        {
          "id": "..."
        },
        {
          "id": "..."
        }
      ],
      "reports": [
        {
          "id": "..."
        },
        {
          "id": "..."
        }
    ]
    }

     

    4. You may refer to this offical blog to get more details about your error.

    For reference:

    API call returning 401

    API call returning 403

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.