Skip to content

[Bug] TenantId Not Overridden in AcquireTokenInteractive When Using Public Client with WithTenantId #5258

@narendran-dev

Description

@narendran-dev

Library version used

4.69.1.0

.NET version

.NET 8.0.8

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, I haven't upgraded MSAL, but started seeing this issue

Issue description and reproduction steps

When using the AcquireTokenInteractive method in MSAL.NET and passing the TenantId (either organisation or consumers), the expected behavior of overriding the tenant ID does not occur. The authentication flow defaults to the common tenant, even when a specific TenantId is passed during the interactive token acquisition.

Relevant code snippets

this._msalClient =  PublicClientApplicationBuilder .Create(authEndPointSetting.CommonEndPointClientId)
                                    .WithDefaultRedirectUri()
                                    .WithLegacyCacheCompatibility(false)
                                    .WithHttpClientFactory(new MsalHttpFactory())
                                    .Build();



            var authRequest = __msalClient.AcquireTokenInteractive(scopes)
                .WithLoginHint(userName)
                .WithUseEmbeddedWebView(isEmbeddedWebView)
                .WithTenantId(tenantId.ConvertToLoginTenantType());// based on the user’s email we will pass consumer or organisation or common.

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions