Hello @JAL · This is expected in case of Multi-Tenant application. As when a multi-tenant application registered in one tenant is accessed by users in different tenant and they accept the consent prompt, a service principal with same ClientID is created in that tenant as well. Which is why technically there is no mismatch in client ID and tenant ID in that case.
In case of multi-tenant applications, authentication request is sent to https://login.microsoftonline.com/common or https://login.microsoftonline.com/organizations and the tenant discovery is done on the basis of the domain name in the UPN suffix of the user. Whereas, in case of single tenant apps, we use specific authority e.g. https://login.microsoftonline.com/tenantname.onmicrosoft.com or https://login.microsoftonline.com/tenant-guid. We cannot specify multiple tenants here as users has to be redirected to a specific url.
In order to restrict users from specific organizations from signing-in your web api, you need to validate the authority/issuer of the tokens and accept tokens only from specified authorities.
-----------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.