Forum Discussion

pragati2405's avatar
pragati2405
New Member
8 years ago
Solved

Unable to get embed token for embeding reports

Hi, I have been finding issues in generating the embed token for javascript embeding of report. I have registered an app on Azure portal and got Client id and secret but unable to figure out what to do do next in order to get Embed token.

  • Eric_Zhang's avatar
    Eric_Zhang
    8 years ago

    pragati2405 wrote:

    Hi, I have been finding issues in generating the embed token for javascript embeding of report. I have registered an app on Azure portal and got Client id and secret but unable to figure out what to do do next in order to get Embed token.


    pragati2405

    To get the embed token, you can reference the code in redirect.aspx.cs in the lib Users Owns Data in Github. You can download the whole C# project and open it in Visual Studio to play and test.

     

    Alternatively in other language, you can call a POST API as below.

    POST /common/oauth2/token HTTP/1.1
    Host: login.windows.net
    Content-Type: application/x-www-form-urlencoded
    Cache-Control: no-cache
    
    client_secret={your client secret}&client_id={your client id}&grant_type=password&resource=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi&username={your Power BI account}&password={your Power BI password}

     

5 Replies

  •  I registered an app on Azure portal and got the client id and secret but cannot figure out how to get the Embed token.

  • Hi, I have been finding issues in generating the embed token for javascript embeding of report. I have registered an app on Azure portal and got Client id and secret but unable to figure out what to do do next in order to get Embed token.

  • Hi, I have been finding issues in generating the embed token for javascript embeding of report. I have registered an app on Azure portal and got Client id and secret but unable to figure out what to do do next in order to get Embed token.

    • Eric_Zhang's avatar
      Eric_Zhang
      Microsoft Employee

      pragati2405 wrote:

      Hi, I have been finding issues in generating the embed token for javascript embeding of report. I have registered an app on Azure portal and got Client id and secret but unable to figure out what to do do next in order to get Embed token.


      pragati2405

      To get the embed token, you can reference the code in redirect.aspx.cs in the lib Users Owns Data in Github. You can download the whole C# project and open it in Visual Studio to play and test.

       

      Alternatively in other language, you can call a POST API as below.

      POST /common/oauth2/token HTTP/1.1
      Host: login.windows.net
      Content-Type: application/x-www-form-urlencoded
      Cache-Control: no-cache
      
      client_secret={your client secret}&client_id={your client id}&grant_type=password&resource=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi&username={your Power BI account}&password={your Power BI password}