Skip to content

[BUG] Setting UseEmbeddedWebView for BrowserCustomizationOptions on InteractiveBrowserCredentialOptions at BrowserCustomization crashes #47826

Open
@dbirler

Description

Library name and version

Azure.Identity 1.13.1

Describe the bug

Azure.Identity.AuthenticationFailedException: 'InteractiveBrowserCredential authentication failed: To enable the embedded webview on Windows, reference Microsoft.Identity.Client.Desktop and call the extension method .WithWindowsEmbeddedBrowserSupport().'

Microsoft.Identity.Client.Platforms.netstandard.NetCoreWebUIFactory.CreateAuthenticationDialog(Microsoft.Identity.Client.UI.CoreUIParent, Microsoft.Identity.Client.ApiConfig.Parameters.WebViewPreference, Microsoft.Identity.Client.Internal.RequestContext) in NetCoreWebUIFactory.cs
    Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.CreateWebAuthenticationDialog() in AuthCodeRequestComponent.cs
    Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync(System.Threading.CancellationToken) in AuthCodeRequestComponent.cs
    Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync(System.Threading.CancellationToken) in InteractiveRequest.cs
    Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync(System.Threading.CancellationToken) in InteractiveRequest.cs
    Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync.AnonymousMethod__1() in RequestBase.cs
    Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(System.Func<System.Threading.Tasks.Task>) in StopWatchService.cs
    Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(System.Threading.CancellationToken) in RequestBase.cs
    Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.ExecuteAsync(Microsoft.Identity.Client.ApiConfig.Parameters.AcquireTokenCommonParameters, Microsoft.Identity.Client.ApiConfig.Parameters.AcquireTokenInteractiveParameters, System.Threading.CancellationToken) in PublicClientExecutor.cs
    Azure.Identity.AbstractAcquireTokenParameterBuilderExtensions.ExecuteAsync<T>(Microsoft.Identity.Client.AbstractAcquireTokenParameterBuilder<T>, bool, System.Threading.CancellationToken) in AbstractAcquireTokenParameterBuilderExtensions.cs

Expected behavior

Works and uses embedded browser.

Actual behavior

Crashes with exception.

Reproduction Steps

InteractiveBrowserCredentialOptions interactiveBrowserCredentialOptions = new InteractiveBrowserCredentialOptions()
{
  BrowserCustomization = new BrowserCustomizationOptions() { UseEmbeddedWebView = true },
  TenantId = "",
  ClientId = "",
  AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
  RedirectUri = new Uri("http://localhost")
};
InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredential(interactiveBrowserCredentialOptions);

var graphClient = new GraphServiceClient(interactiveBrowserCredential);

Environment

.NET 9
Visual Studio 17.12.3

Azure.Identity 1.13.1
Microsoft.Graph 5.68.0
Microsoft.Identity.Client.Desktop 4.67.1
Microsoft.Windows.SDK.BuildTools 10.0.26100.1742
Microsoft.WindowsAppSDK 1.6.241114003

Metadata

Assignees

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions