Update default API token expiration to 50 years

- Change default token expiration from 1 year (365 days) to 50 years (365*50 days)
- This provides long-term API access for external applications
- Tokens created with the new default will expire in approximately 2074
- Custom expiration periods can still be specified when creating tokens
parent 853bff19
...@@ -50,9 +50,9 @@ class User(UserMixin, db.Model): ...@@ -50,9 +50,9 @@ class User(UserMixin, db.Model):
# Generate a secure random token # Generate a secure random token
token_value = secrets.token_urlsafe(32) token_value = secrets.token_urlsafe(32)
# Set expiration (default to 1 year if not specified) # Set expiration (default to 50 years if not specified)
if expires_in is None: if expires_in is None:
expires_at = datetime.utcnow() + timedelta(days=365) expires_at = datetime.utcnow() + timedelta(days=365*50) # 50 years
else: else:
expires_at = datetime.utcnow() + expires_in expires_at = datetime.utcnow() + expires_in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment