Forum Discussion

isthisworking's avatar
isthisworking
Microsoft Employee
6 years ago

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