Home > front end >  Azure AD Silent Authentication from Desktop App C#
Azure AD Silent Authentication from Desktop App C#

Time:11-06

I am trying to have silent authentication with Azure AD from a desktop app. I am using MSAL.NET 4.72.2, specifically this particular call. It is not recommended by Microsoft for some specific reasons, none of them applies to my case. However, it is supposed to work silently, like in a traditional case, you pop up a login WinForm in the app and provide user name and password. Then click OK and eventually it comes down to this call:

 authResult = await app.AcquireTokenByUsernamePassword(
              scopes,
              ClientApp.SafeStorage.DecryptString(ClientApp.Username),
              ClientApp.SafeStorage.DecryptString(ClientApp.Pwd))
              .ExecuteAsync(CancellationToken.None)
              .ConfigureAwait(true);

where ClientApp.Username and ClientApp.Pwd are username and password. The problem is that this call fails against Azure AD without MFA enabled for that account:

Microsoft.Identity.Client.MsalServiceException: 'A configuration issue is preventing authentication - check the error message from the server for details. You can modify the configuration in the application registration portal. See enter image description here

  • Related