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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
isthisworking
Microsoft Employee
Microsoft Employee

Acquire a token when PlatformParameters definition change migrating to .NET Core 3.1

Hi All,
 
I've run into a problem with a C# console app that (for reasons) is being moved from .NET Framework to .NET Core. In the process of retargeting the app, the following line of code to get the access token is no longer syntactically correct:
 
AuthenticationResult result =
    await m_authenticationContext.AcquireTokenAsync(
        resourceUri,
        clientID,
        new Uri(redirectUri),
        new PlatformParameters(PromptBehavior.Auto));
 
The constructor for PlatformParameters no longer accepts the single parameter. It now requires a second parameter of ICustomWebUi. The desired (and previous) behavior of the console app is that, when run, it does not require user interaction to authenticate. This needs to run headless. What would be the easiest method to refactor the code to maintain parity?
 
Thanks.

1 REPLY 1
michaelx2
Microsoft Employee
Microsoft Employee

Hello @isthisworking ,

The seconed parameter ICustomWebUi is extension method enabling ADAK.NET extenders for public client applications to set a custom web ui that will let the user sign-in with Azure AD, present consent if needed, and get back the authorization code.  You may refer to a sample implement here:

https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/blob/66f89589b878c1a7cfb12e46f60... 

 

In your scenario, you want to run the app in headless mode, since that, you may try to use 3rd party library PowerBI.Api.Client  which already implemented Automatic OAuth2 authentication.

 

Best Regards

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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