Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] When using .WithTenantId() with a dSTS authority, get tenant_override_non_aad error #4144

Closed
jennyf19 opened this issue May 22, 2023 · 0 comments · Fixed by #4146
Closed

Comments

@jennyf19
Copy link
Collaborator

Based on testing from @JoshLozensky with Id Web and a dSTS authority, we are getting:

        ErrorCode: tenant_override_non_aad
Microsoft.Identity.Client.MsalClientException: WithTenantId can only be used when an AAD authority is specified at the application level.
   at Microsoft.Identity.Client.AbstractAcquireTokenParameterBuilder`1.WithTenantId(String tenantId)
   at Microsoft.Identity.Web.TokenAcquisition.GetAuthenticationResultForAppAsync(String scope, String authenticationScheme, String tenant, TokenAcquisitionOptions tokenAcquisitionOptions)
   at Microsoft.Identity.Web.DefaultAuthorizationHeaderProvider.CreateAuthorizationHeaderForAppAsync(String scopes, AuthorizationHeaderProviderOptions downstreamApiOptions, CancellationToken cancellationToken)
   at Microsoft.Identity.Web.DownstreamApi.CallApiInternalAsync(String serviceName, DownstreamApiOptions effectiveOptions, Boolean appToken, HttpContent content, ClaimsPrincipal user, CancellationToken cancellationToken)
   at Microsoft.Identity.Web.DownstreamApi.GetForAppAsync[TOutput](String serviceName, Action`1 downstreamApiOptionsOverride, CancellationToken cancellationToken)
   at Program.<Main>$(String[] args) in C:\workingDirectory\MicrosoftIdentityClientInternal\Samples\daemon-console\daemon-console\Program.cs:line 29
   at Program.<Main>(String[] args)

Because MSAL is not including dSTS in the tenant override, only AadAuthority:

internal bool IsTenantOverrideSupported => AuthorityType == AuthorityType.Aad;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment