Skip to content

Commit

Permalink
Update repo_api_tokens.py (#6853)
Browse files Browse the repository at this point in the history
  • Loading branch information
r350178982 authored Sep 27, 2024
1 parent e92732a commit 7d75f8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion seahub/api2/endpoints/repo_api_tokens.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import jwt
import time
from rest_framework import status
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
Expand Down Expand Up @@ -180,7 +181,7 @@ def get(self, request, repo_id):
payload = {
'username': username,
'repo_id': repo_id,
'exp': 3 * 3600 * 24 # default by three days
'exp': int(time.time()) + 3 * 3600 * 24 # default by three days
}
jwt_token = jwt.encode(payload, JWT_PRIVATE_KEY, algorithm='HS256')
except Exception as e:
Expand Down

0 comments on commit 7d75f8c

Please sign in to comment.