-
-
Notifications
You must be signed in to change notification settings - Fork 247
Allow to disable expiration time claim #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Setting expires_delta to timedelta(0) removes the "exp" claim and creates a token that never expires. Fix issue vimalloc#105
docs/options.rst
Outdated
| ``JWT_REFRESH_TOKEN_EXPIRES`` How long a refresh token should live before it expires. This | ||
| takes a ``datetime.timedelta``, and defaults to 30 days | ||
| takes a ``datetime.timedelta``, and defaults to 30 days. | ||
| Can be set to ``datetime.timedelta(0)`` to disable expiration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be more intuitive to set the expires delta to False instead of datetime.timedelta(0). I think that may be more clear about how it is used and the purpose of it, if someone looking at this out in the wild somewhere.
I think it would only need to be updated in the documentation, because the create_token methods explicitly check for if expires delta is None: https://github.com/vimalloc/flask-jwt-extended/blob/master/flask_jwt_extended/jwt_manager.py#L375
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that might be more intuitive.
JWT_ACCESS_TOKEN_EXPIRES currently must be a datetime.timedelta: https://github.com/vimalloc/flask-jwt-extended/blob/master/flask_jwt_extended/config.py#L154
So there is some code impact, but that should be minor.
This is more intuitive than timedelta(0)
|
This looks great. Thanks for contributing! 👍 |
Setting expires_delta to timedelta(0) removes the "exp" claim
and creates a token that never expires.
Fix issue #105