Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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.
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:
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