File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -636,6 +636,7 @@ def initiate_auth_code_flow(
636
636
domain_hint = None , # type: Optional[str]
637
637
claims_challenge = None ,
638
638
max_age = None ,
639
+ response_mode = None , # type: Optional[str]
639
640
):
640
641
"""Initiate an auth code flow.
641
642
@@ -673,6 +674,13 @@ def initiate_auth_code_flow(
673
674
If the elapsed time is greater than this value,
674
675
Microsoft identity platform will actively re-authenticate the End-User.
675
676
677
+ :param str response_mode:
678
+ OPTIONAL. Response mode for the callback; can be either "form_post"
679
+ for POST to callback URI or "query" (the default) for GET with
680
+ parameters encoded in query string.
681
+ More information on possible values
682
+ `here <https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html>`
683
+
676
684
MSAL Python will also automatically validate the auth_time in ID token.
677
685
678
686
New in version 1.15.
@@ -706,7 +714,7 @@ def initiate_auth_code_flow(
706
714
domain_hint = domain_hint ,
707
715
claims = _merge_claims_challenge_and_capabilities (
708
716
self ._client_capabilities , claims_challenge ),
709
- max_age = max_age ,
717
+ max_age = max_age , response_mode = response_mode ,
710
718
)
711
719
flow ["claims_challenge" ] = claims_challenge
712
720
return flow
Original file line number Diff line number Diff line change @@ -184,6 +184,9 @@ def initiate_auth_code_flow(
184
184
# Here we just automatically add it. If the caller do not want id_token,
185
185
# they should simply go with oauth2.Client.
186
186
_scope .append ("openid" )
187
+ response_mode = kwargs .get ("response_mode" )
188
+ if response_mode is not None and (response_mode != "form_post" or response_mode != "query" ):
189
+ raise ValueError ('response_mode="form_post" or response_mode="query" is allowed' )
187
190
nonce = "" .join (random .sample (string .ascii_letters , 16 ))
188
191
flow = super (Client , self ).initiate_auth_code_flow (
189
192
scope = _scope , nonce = _nonce_hash (nonce ), ** kwargs )
You can’t perform that action at this time.
0 commit comments