@@ -19,11 +19,9 @@ def _encode_jwt(additional_token_data, expires_delta, secret, algorithm):
1919 'nbf' : now ,
2020 'jti' : uid ,
2121 }
22- # If expires_delta is timedelta(0) , the JWT should never expire
22+ # If expires_delta is False , the JWT should never expire
2323 # and the 'exp' claim is not set.
2424 if expires_delta :
25- # A timedelta object is considered to be true if and only if
26- # it isn't equal to timedelta(0)
2725 token_data ['exp' ] = now + expires_delta
2826 token_data .update (additional_token_data )
2927 encoded_token = jwt .encode (token_data , secret , algorithm ).decode ('utf-8' )
@@ -40,8 +38,8 @@ def encode_access_token(identity, secret, algorithm, expires_delta, fresh,
4038 :param secret: Secret key to encode the JWT with
4139 :param algorithm: Which algorithm to encode this JWT with
4240 :param expires_delta: How far in the future this token should expire
43- (set to timedelta(0) to disable expiration)
44- :type expires_delta: datetime.timedelta
41+ (set to False to disable expiration)
42+ :type expires_delta: datetime.timedelta or False
4543 :param fresh: If this should be a 'fresh' token or not
4644 :param user_claims: Custom claims to include in this token. This data must
4745 be json serializable
@@ -75,8 +73,8 @@ def encode_refresh_token(identity, secret, algorithm, expires_delta, csrf,
7573 :param secret: Secret key to encode the JWT with
7674 :param algorithm: Which algorithm to use for the toek
7775 :param expires_delta: How far in the future this token should expire
78- (set to timedelta(0) to disable expiration)
79- :type expires_delta: datetime.timedelta
76+ (set to False to disable expiration)
77+ :type expires_delta: datetime.timedelta or False
8078 :param csrf: Whether to include a csrf double submit claim in this token
8179 (boolean)
8280 :param identity_claim_key: Which key should be used to store the identity
0 commit comments