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 dSTS authority with WithTenantId & have applied fix from: #4144, get cast error #4145

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

Comments

@jennyf19
Copy link
Collaborator

Unable to cast object of type 'Microsoft.Identity.Client.Instance.DstsAuthority' to type 'Microsoft.Identity.Client.Instance.AadAuthority'.

On this line: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/main/src/client/Microsoft.Identity.Client/ApiConfig/AbstractAcquireTokenParameterBuilder.cs#L277

If a dSTS authority is used, the code is casting for an AadAuthority, but AuthorityInfo is dSTS, so the cast fails:

AadAuthority aadAuthority = (AadAuthority)ServiceBundle.Config.Authority;

You have a test checking for dSTS authority types here, but it's using [WithTenantIdFromAuthority](

which is not what we use in Id Web, we use .WithTenantId().

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