diff --git a/msal/authority.py b/msal/authority.py index 56b3d4c6..667f5ebd 100644 --- a/msal/authority.py +++ b/msal/authority.py @@ -48,7 +48,9 @@ def __init__(self, authority_url, validate_authority=True, self.proxies = proxies self.timeout = timeout authority, self.instance, tenant = canonicalize(authority_url) - is_b2c = any(self.instance.endswith("." + d) for d in WELL_KNOWN_B2C_HOSTS) + parts = authority.path.split('/') + is_b2c = any(self.instance.endswith("." + d) for d in WELL_KNOWN_B2C_HOSTS) or ( + len(parts) == 3 and parts[2].lower().startswith("b2c_")) if (tenant != "adfs" and (not is_b2c) and validate_authority and self.instance not in WELL_KNOWN_AUTHORITY_HOSTS): payload = instance_discovery(