Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Yaostha
Helper II
Helper II

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 3
Eric_Zhang
Employee
Employee


@Yaostha wrote:

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


@Yaostha

Don't know much about AAD v2, hope those threads help.

Azure Active Directory Code Samples

ADAL.js

PowerBI-Developer-Samples

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 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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.