flask-praetorian icon indicating copy to clipboard operation
flask-praetorian copied to clipboard

encoding a jwt and specifying the override_access_lifespan parameter

Open iqmia opened this issue 3 years ago • 1 comments

When encoding a jwt and specifying the override_access_lifespan parameter using a dictionary as per the documentation, an error is thrown: (unsupported operand type(s) for +: 'DateTime' and 'dict') I solved the problem by using datetime.timedelta() to set the override_access_lifespan parameter. I suggest either add a check in encode_jwt_token method as you did with the JWT_ACCESS_LIFESPAN:

if isinstance(self.access_lifespan, dict): self.access_lifespan = pendulum.duration(**self.access_lifespan)

or mention in the documentation that it should be of type timedelta.

thank you ,

iqmia avatar Nov 27 '21 22:11 iqmia

Thanks for the heads-up here. I will look into this.

dusktreader avatar Feb 17 '22 04:02 dusktreader