Reply
Highlighted
Regular Visitor
Posts: 33
Registered: ‎10-06-2017

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

[ Edited ]

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

Moderator
Posts: 3,051
Registered: ‎03-06-2016

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

[ Edited ]

@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

Regular Visitor
Posts: 33
Registered: ‎10-06-2017

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

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

Moderator
Posts: 3,051
Registered: ‎03-06-2016

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


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