.Net MAUI - Microsoft.Identity.Client with latest Version="4.66.2" is giving the exception as "To enable the embedded webview on Windows, reference Microsoft.Identity.Client.Desktop and call the extension method .WithWindowsEmbeddedBrowserSupport()."

Thanniru, Anitha 5 Reputation points
2024-11-22T10:48:25.94+00:00

Hello,

I was using the Microsoft.Identity.Client with version 4.60.3 is giving the vulnerable error. Hence I recently upgraded my Microsoft.Identity.Client version from "4.60.3" to 4.66.2.

Previous versions

<PackageReference Include="Microsoft.Identity.Client" Version="4.60.3" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.57.0" />


Upgraded versions

<PackageReference Include="Microsoft.Identity.Client" Version="4.66.2" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.66.2" />



After the upgradation, my app is failing the authentication and throwing the exceptions as

"To enable the embedded webview on Windows, reference Microsoft.Identity.Client.Desktop and call the extension method .WithWindowsEmbeddedBrowserSupport()."

And when I tried to add the package as it suggested in the error I'm not able to find the method ".WithWindowsEmbeddedBrowserSupport()"

My existing Authentication logic is as below,



public IPublicClientApplication mPublicClientApplication;

mPublicClientApplication = PublicClientApplicationBuilder.Create(ClientId)
															.WithAuthority(Authority)
															.WithRedirectUri(RedirectUri)
															.Build();
AttachTokenCache(mPublicClientApplication.UserTokenCache);




AuthenticationResult result = await mPublicClientApplication.AcquireTokenInteractive(Scopes)
					  .WithUseEmbeddedWebView(true)
					  .ExecuteAsync();


Due to this we are unable to proceed further to use the app.

Need a quick help in this as it is a blocker for the app usage.

Thanks in advance

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,072 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,228 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.