From 43175625c70d33d3adc91e63fd6a04e1a9d6f1dd Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Tue, 10 Sep 2024 09:42:39 -0400 Subject: [PATCH] oauth: handle a string expires_in value gracefully If an OAuth token's expires_in field is a string instead of an int, simply try to convert it to an int first. Fixes https://github.com/smart-on-fhir/client-py/issues/179 --- fhirclient/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fhirclient/auth.py b/fhirclient/auth.py index 0127ff980..94c82d3a5 100644 --- a/fhirclient/auth.py +++ b/fhirclient/auth.py @@ -283,7 +283,7 @@ def _request_access_token(self, server, params): del ret_params['access_token'] if 'expires_in' in ret_params: - expires_in = ret_params.get('expires_in') + expires_in = int(ret_params['expires_in']) self.expires_at = datetime.now() + timedelta(seconds=expires_in) del ret_params['expires_in']