@@ -466,9 +466,11 @@ def __init__(
466
466
self .http_client , validate_authority = False )
467
467
else :
468
468
raise
469
- self ._enable_broker = (
470
- isinstance (self , PublicClientApplication ) # Exclude Confidential ROPC
471
- and sys .platform == "win32" and not self .authority .is_adfs )
469
+ is_public_app = (isinstance (self , PublicClientApplication ) or
470
+ (isinstance (self , ClientApplication ) and not self .client_credential ))
471
+ self ._enable_broker = (is_public_app
472
+ and sys .platform == "win32"
473
+ and not self .authority .is_adfs and not self .authority ._is_b2c )
472
474
473
475
self .token_cache = token_cache or TokenCache ()
474
476
self ._region_configured = azure_region
@@ -1225,7 +1227,7 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
1225
1227
try :
1226
1228
from .wam import _acquire_token_silently
1227
1229
response = _acquire_token_silently (
1228
- "https://{}/{}" .format (self .authority .instance , self .authority .tenant ), # TODO: What about B2C & ADFS?
1230
+ "https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
1229
1231
self .client_id ,
1230
1232
account ["local_account_id" ],
1231
1233
scopes ,
@@ -1438,14 +1440,14 @@ def acquire_token_by_username_password(
1438
1440
try :
1439
1441
from .wam import _signin_silently , RedirectUriError
1440
1442
response = _signin_silently (
1441
- "https://{}/{}" .format (self .authority .instance , self .authority .tenant ), # TODO: What about B2C?
1443
+ "https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
1442
1444
self .client_id ,
1443
1445
scopes , # Decorated scopes won't work due to offline_access
1444
1446
MSALRuntime_Username = username ,
1445
1447
MSALRuntime_Password = password ,
1446
1448
validateAuthority = "no"
1447
1449
if self .authority ._validate_authority is False
1448
- or self .authority .is_adfs
1450
+ or self .authority .is_adfs or self . authority . _is_b2c
1449
1451
else None ,
1450
1452
claims = claims ,
1451
1453
)
@@ -1625,12 +1627,12 @@ def acquire_token_interactive(
1625
1627
if "welcome_template" in kwargs :
1626
1628
logger .debug (kwargs ["welcome_template" ]) # Experimental
1627
1629
response = _signin_interactively (
1628
- "https://{}/{}" .format (self .authority .instance , self .authority .tenant ), # TODO: What about B2C?
1630
+ "https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
1629
1631
self .client_id ,
1630
1632
scopes ,
1631
1633
validateAuthority = "no"
1632
1634
if self .authority ._validate_authority is False
1633
- or self .authority .is_adfs
1635
+ or self .authority .is_adfs or self . authority . _is_b2c
1634
1636
else None ,
1635
1637
login_hint = login_hint ,
1636
1638
prompt = prompt ,
0 commit comments