23
23
except (ImportError , AttributeError ): # AttributeError happens when a prior pymsalruntime uninstallation somehow leaved an empty folder behind
24
24
# PyMsalRuntime currently supports these Windows versions, listed in this MSFT internal link
25
25
# https://github.com/AzureAD/microsoft-authentication-library-for-cpp/pull/2406/files
26
- raise ImportError ( # TODO: Remove or adjust this line right before merging this PR
27
- 'You need to install dependency by: pip install "msal[broker]>=1.20,<2"' )
26
+ raise ImportError ('You need to install dependency by: pip install "msal[broker]>=1.20,<2"' )
28
27
# It could throw RuntimeError when running on ancient versions of Windows
29
28
30
29
@@ -84,9 +83,11 @@ def _read_account_by_id(account_id, correlation_id):
84
83
85
84
86
85
def _convert_result (result , client_id , expected_token_type = None ): # Mimic an on-the-wire response from AAD
86
+ telemetry = result .get_telemetry_data ()
87
+ telemetry .pop ("wam_telemetry" , None ) # In pymsalruntime 0.13, it contains PII "account_id"
87
88
error = result .get_error ()
88
89
if error :
89
- return _convert_error (error , client_id )
90
+ return dict ( _convert_error (error , client_id ), _msalruntime_telemetry = telemetry )
90
91
id_token_claims = json .loads (result .get_id_token ()) if result .get_id_token () else {}
91
92
account = result .get_account ()
92
93
assert account , "Account is expected to be always available"
@@ -107,7 +108,7 @@ def _convert_result(result, client_id, expected_token_type=None): # Mimic an on
107
108
granted_scopes = result .get_granted_scopes () # New in pymsalruntime 0.3.x
108
109
if granted_scopes :
109
110
return_value ["scope" ] = " " .join (granted_scopes ) # Mimic the on-the-wire data format
110
- return return_value
111
+ return dict ( return_value , _msalruntime_telemetry = telemetry )
111
112
112
113
113
114
def _get_new_correlation_id ():
0 commit comments