Skip to content

Commit 3eaf962

Browse files
seedifferentlyskion
authored andcommitted
Remove handling of nonstandard parameter "expires" (#506)
1 parent 481a4ec commit 3eaf962

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

oauthlib/oauth2/rfc6749/parameters.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,13 @@ def parse_token_response(body, scope=None):
362362
# https://github.com/oauthlib/oauthlib/issues/267
363363

364364
params = dict(urlparse.parse_qsl(body))
365-
for key in ('expires_in', 'expires'):
366-
if key in params: # cast a couple things to int
365+
for key in ('expires_in',):
366+
if key in params: # cast things to int
367367
params[key] = int(params[key])
368368

369369
if 'scope' in params:
370370
params['scope'] = scope_to_list(params['scope'])
371371

372-
if 'expires' in params:
373-
params['expires_in'] = params.pop('expires')
374-
375372
if 'expires_in' in params:
376373
params['expires_at'] = time.time() + int(params['expires_in'])
377374

tests/oauth2/rfc6749/test_parameters.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,6 @@ def setUp(self):
115115
' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",'
116116
' "example_parameter": "example_value" }')
117117

118-
json_expires = ('{ "access_token": "2YotnFZFEjr1zCsicMWpAA",'
119-
' "token_type": "example",'
120-
' "expires": 3600,'
121-
' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",'
122-
' "example_parameter": "example_value",'
123-
' "scope":"abc def"}')
124-
125118
json_dict = {
126119
'access_token': '2YotnFZFEjr1zCsicMWpAA',
127120
'token_type': 'example',
@@ -264,7 +257,3 @@ def record_scope_change(sender, message, old, new):
264257
finally:
265258
signals.scope_changed.disconnect(record_scope_change)
266259
del os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE']
267-
268-
def test_token_response_with_expires(self):
269-
"""Verify fallback for alternate spelling of expires_in. """
270-
self.assertEqual(parse_token_response(self.json_expires), self.json_dict)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy