Forum Discussion

Yaostha's avatar
Yaostha
Icon for Helper II rankHelper II
8 years ago

Register with AAD V2 and authenticate using MSAL.js or ADAL.js

Hi,

   Is it possible to authenticate to apps registered with AAD v2 for PowerBI via MSAL or ADAL?

 

It would be great if we get any sample code.

 

Regards,

Yasotha

3 Replies

    • Yaostha's avatar
      Yaostha
      Icon for Helper II rankHelper II

      Hi Eric_Zhang,

          Thanks for the reply.

      Now I got another doubt.

       

      How do we get the Microsoft.PowerBI.Api.V2.Models.EmbedToken generated using powerbi javascript? Is it possible?

       

      I have below code in my .cs file. I am looking to replace the same using javascript approach.

      using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
      {

      // Generate Embed Token.
      var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
      var tokenResponse = await client.Dashboards.GenerateTokenInGroupAsync(GroupId, DashboardId, generateTokenRequestParameters);

      }

       

      Regards,

      Yasotha

      • Eric_Zhang's avatar
        Eric_Zhang
        Icon for Microsoft Employee rankMicrosoft Employee

        Yaostha wrote:

        Hi Eric_Zhang,

            Thanks for the reply.

        Now I got another doubt.

         

        How do we get the Microsoft.PowerBI.Api.V2.Models.EmbedToken generated using powerbi javascript? Is it possible?

         

        I have below code in my .cs file. I am looking to replace the same using javascript approach.

        using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
        {

        // Generate Embed Token.
        var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
        var tokenResponse = await client.Dashboards.GenerateTokenInGroupAsync(GroupId, DashboardId, generateTokenRequestParameters);

        }

         

        Regards,

        Yasotha


        Yaostha

        Just call the API GenerateToken in Javascript API or JQuery.