Skip to content

[Bug] Cannot use MSAL authentication pop up in a partialTrustApplication #5372

@catmanjan

Description

@catmanjan

Library version used

4.73.1

.NET version

8

Scenario

PublicClient - desktop app

Is this a new or an existing app?

None

Issue description and reproduction steps

I have a WinUI3 app which has partial trust so I need to do the authentication like so:

            var scopes = new[] { "User.Read" };

            var clientId = "beb05e1a-86eb-4d44-92a3-1ab1b41c1510";

            var options = new BrokerOptions(BrokerOptions.OperatingSystems.Windows)
            {
                Title = "My Awesome Application"
            };

            IPublicClientApplication app =
                PublicClientApplicationBuilder.Create(clientId)
                .WithBroker(options)
                .WithParentActivityOrWindow(() => WinRT.Interop.WindowNative.GetWindowHandle(this))
                .WithRedirectUri("ms-appx-web://microsoft.aad.brokerplugin/beb05e1a-86eb-4d44-92a3-1ab1b41c1510")
                .WithAuthority(AadAuthorityAudience.AzureAdMultipleOrgs)
                .Build();

            var result = await app.AcquireTokenInteractive(scopes).ExecuteAsync();

The last line throws an exception:

Microsoft.Identity.Client.MsalServiceException: 'Unknown Status: Unexpected
Error: 0xffffffff80073b27
Context: (pii)
Tag: 0x21420087 (error code -2147009753) (internal error code 557973639)'

I've included a whole zip of the project showing the issue.

EntraWithPartialTrust.zip

Relevant code snippets

Expected behavior

No response

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions