@@ -221,8 +221,6 @@ class ClientApplication(object):
221
221
"You can enable broker by following these instructions. "
222
222
"https://msal-python.readthedocs.io/en/latest/#publicclientapplication" )
223
223
224
- _enable_broker = False
225
-
226
224
def __init__ (
227
225
self , client_id ,
228
226
client_credential = None , authority = None , validate_authority = True ,
@@ -651,14 +649,22 @@ def _decide_broker(self, allow_broker, enable_pii_log):
651
649
"enable_broker_on_windows=True, "
652
650
"enable_broker_on_mac=...)" ,
653
651
DeprecationWarning )
654
- self ._enable_broker = self ._enable_broker or (
652
+ opted_in_for_broker = (
653
+ self ._enable_broker # True means Opted-in from PCA
654
+ or (
655
655
# When we started the broker project on Windows platform,
656
656
# the allow_broker was meant to be cross-platform. Now we realize
657
657
# that other platforms have different redirect_uri requirements,
658
658
# so the old allow_broker is deprecated and will only for Windows.
659
659
allow_broker and sys .platform == "win32" )
660
- if (self ._enable_broker and not is_confidential_app
661
- and not self .authority .is_adfs and not self .authority ._is_b2c ):
660
+ )
661
+ self ._enable_broker = ( # This same variable will also store the state
662
+ opted_in_for_broker
663
+ and not is_confidential_app
664
+ and not self .authority .is_adfs
665
+ and not self .authority ._is_b2c
666
+ )
667
+ if self ._enable_broker :
662
668
try :
663
669
_init_broker (enable_pii_log )
664
670
except RuntimeError :
0 commit comments