@@ -1598,6 +1598,7 @@ def acquire_token_interactive(
1598
1598
extra_scopes_to_consent = None ,
1599
1599
max_age = None ,
1600
1600
window = None ,
1601
+ enable_msa_passthrough = None ,
1601
1602
** kwargs ):
1602
1603
"""Acquire token interactively i.e. via a local browser.
1603
1604
@@ -1660,6 +1661,13 @@ def acquire_token_interactive(
1660
1661
you are recommended to also provide its window handle,
1661
1662
so that the sign in UI window will properly pop up on top of your window.
1662
1663
1664
+ :param boolean enable_msa_passthrough:
1665
+ OPTIONAL. MSA-Passthrough is a legacy configuration,
1666
+ needed by a small amount of Microsoft first-party apps,
1667
+ which would login MSA accounts via ".../organizations" authority.
1668
+ If you app belongs to this category, AND you are enabling broker,
1669
+ you would want to enable this flag. Default value is equivalent to False.
1670
+
1663
1671
:return:
1664
1672
- A dict containing no "error" key,
1665
1673
and typically contains an "access_token" key.
@@ -1686,14 +1694,21 @@ def acquire_token_interactive(
1686
1694
"no" if self .authority ._validate_authority is False
1687
1695
or self .authority .is_adfs or self .authority ._is_b2c
1688
1696
else None )
1689
-
1697
+ enable_msa_passthrough = self .client_id in [
1698
+ # Experimental: Automatically enable MSA-PT mode for known MSA-PT apps
1699
+ # More background of MSA-PT is available from this internal docs:
1700
+ # https://microsoft.sharepoint.com/:w:/t/Identity-DevEx/EatIUauX3c9Ctw1l7AQ6iM8B5CeBZxc58eoQCE0IuZ0VFw?e=tgc3jP&CID=39c853be-76ea-79d7-ee73-f1b2706ede05
1701
+ "04b07795-8ddb-461a-bbee-02f9e1bf7b46" , # Azure CLI
1702
+ "04f0c124-f2bc-4f59-8241-bf6df9866bbd" , # Visual Studio
1703
+ ] if enable_msa_passthrough is None else enable_msa_passthrough
1690
1704
# Call _signin_silently() and/or _signin_interactively()
1691
1705
if prompt == "none" or (not prompt and not login_hint ):
1692
1706
response = _signin_silently (
1693
1707
authority , self .client_id , scopes ,
1694
1708
validateAuthority = validate_authority ,
1695
1709
claims = claims ,
1696
1710
max_age = max_age ,
1711
+ enable_msa_pt = enable_msa_passthrough ,
1697
1712
** kwargs .get ("data" , {}))
1698
1713
import pymsalruntime
1699
1714
if prompt == "none" or response .get ("_broker_status" ) not in (
@@ -1710,6 +1725,7 @@ def acquire_token_interactive(
1710
1725
claims = claims ,
1711
1726
max_age = max_age ,
1712
1727
window = window ,
1728
+ enable_msa_pt = enable_msa_passthrough ,
1713
1729
** kwargs .get ("data" , {}))
1714
1730
return self ._process_broker_response (response , scopes , kwargs .get ("data" , {}))
1715
1731
0 commit comments