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