File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -196,16 +196,23 @@ def _extract_expiry(self, jwt):
196
196
except Exception as original_exception :
197
197
raise Exception ('%s: "%s"' % (error_message , original_exception ))
198
198
199
- if not type (jwt_data_parsed ) is dict and not 'exp' in jwt_data_parsed . keys () :
199
+ if not type (jwt_data_parsed ) is dict :
200
200
raise Exception (error_message )
201
201
202
- try :
203
- expiry = int (jwt_data_parsed ['exp' ])
202
+ if 'exp' in jwt_data_parsed .keys ():
203
+ try :
204
+ expiry = int (jwt_data_parsed ['exp' ])
204
205
205
- except Exception as original_exception :
206
- raise Exception ('%s: "%s"' % (error_message , original_exception ))
206
+ except Exception as original_exception :
207
+ raise Exception ('%s: "%s"' % (error_message , original_exception ))
208
+
209
+ _log .debug ('Extracted expiry time: %i' % expiry )
210
+
211
+ # Seems that expiry isn't always passed on, set token to expire in 1 hour in those cases
212
+ else :
213
+ expiry = int (time .time () + 3600 )
207
214
208
- _log .debug ('Extracted expiry time: %i' % expiry )
215
+ _log .debug ('Expiry not found in JWT, expiry time set to : %i' % expiry )
209
216
210
217
return expiry
211
218
You can’t perform that action at this time.
0 commit comments