Skip to content

Commit f4ac924

Browse files
committed
Add a deprecation warning on the params field of _obtain_token
1 parent f0dec59 commit f4ac924

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

msal/oauth2cli/oauth2.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,23 @@ def _build_auth_request_params(self, response_type, **kwargs):
184184

185185
def _obtain_token( # The verb "obtain" is influenced by OAUTH2 RFC 6749
186186
self, grant_type,
187-
params=None, # a dict to be sent as query string to the endpoint
188187
data=None, # All relevant data, which will go into the http body
189188
headers=None, # a dict to be sent as request headers
190189
post=None, # A callable to replace requests.post(), for testing.
191-
# Such as: lambda url, **kwargs:
192-
# Mock(status_code=200, text='{}')
193190
**kwargs # Relay all extra parameters to underlying requests
194-
): # Returns the json object came from the OAUTH2 response
191+
):
192+
193+
# Handle deprecated params parameter
194+
params = kwargs.pop('params', None)
195+
if params is not None:
196+
import warnings
197+
warnings.warn(
198+
"Setting 'params' is recommended for production scenarios. "
199+
"It will be removed in a future release, and the behavior may be replaced by a new API.",
200+
FutureWarning,
201+
stacklevel=2
202+
)
203+
195204
_data = {'client_id': self.client_id, 'grant_type': grant_type}
196205

197206
if self.default_body.get("client_assertion_type") and self.client_assertion:

0 commit comments

Comments
 (0)