@@ -19,12 +19,12 @@ def _get_app_and_auth_code(
1919 authority = "https://login.microsoftonline.com/common" ,
2020 port = 44331 ,
2121 scopes = ["https://graph.microsoft.com/.default" ], # Microsoft Graph
22- ):
22+ ** kwargs ):
2323 from msal .oauth2cli .authcode import obtain_auth_code
2424 app = msal .ClientApplication (client_id , client_secret , authority = authority )
2525 redirect_uri = "http://localhost:%d" % port
2626 ac = obtain_auth_code (port , auth_uri = app .get_authorization_request_url (
27- scopes , redirect_uri = redirect_uri ))
27+ scopes , redirect_uri = redirect_uri , ** kwargs ))
2828 assert ac is not None
2929 return (app , ac , redirect_uri )
3030
@@ -124,20 +124,21 @@ def test_username_password(self):
124124 self .skipUnlessWithConfig (["client_id" , "username" , "password" , "scope" ])
125125 self ._test_username_password (** self .config )
126126
127- def _get_app_and_auth_code (self ):
127+ def _get_app_and_auth_code (self , ** kwargs ):
128128 return _get_app_and_auth_code (
129129 self .config ["client_id" ],
130130 client_secret = self .config .get ("client_secret" ),
131131 authority = self .config .get ("authority" ),
132132 port = self .config .get ("listen_port" , 44331 ),
133133 scopes = self .config ["scope" ],
134- )
134+ ** kwargs )
135135
136136 def test_auth_code (self ):
137137 self .skipUnlessWithConfig (["client_id" , "scope" ])
138- (self .app , ac , redirect_uri ) = self ._get_app_and_auth_code ()
138+ nonce = "foo"
139+ (self .app , ac , redirect_uri ) = self ._get_app_and_auth_code (nonce = nonce )
139140 result = self .app .acquire_token_by_authorization_code (
140- ac , self .config ["scope" ], redirect_uri = redirect_uri )
141+ ac , self .config ["scope" ], redirect_uri = redirect_uri , nonce = nonce )
141142 logger .debug ("%s.cache = %s" ,
142143 self .id (), json .dumps (self .app .token_cache ._cache , indent = 4 ))
143144 self .assertIn (
0 commit comments