feat: jwt过期时间以s为单位
This commit is contained in:
@@ -141,16 +141,16 @@ def add_user_route(app: FastAPI):
|
||||
access_token = CryptUtils.create_token(
|
||||
username=user.username,
|
||||
type="access",
|
||||
expires_delta=timedelta(minutes=env.jwt_access_token_expire_minutes),
|
||||
expires_delta=timedelta(seconds=env.jwt_access_token_expire_seconds),
|
||||
)
|
||||
access_expires = env.jwt_access_token_expire_minutes * 60 * 1000
|
||||
access_expires = env.jwt_access_token_expire_seconds * 1000
|
||||
|
||||
refresh_token = CryptUtils.create_token(
|
||||
username=user.username,
|
||||
type="refresh",
|
||||
expires_delta=timedelta(minutes=env.jwt_refresh_token_expire_minutes),
|
||||
expires_delta=timedelta(minutes=env.jwt_refresh_token_expire_seconds),
|
||||
)
|
||||
refresh_expires = env.jwt_refresh_token_expire_minutes * 60 * 1000
|
||||
refresh_expires = env.jwt_refresh_token_expire_seconds * 1000
|
||||
|
||||
return {
|
||||
"result": user,
|
||||
@@ -173,9 +173,9 @@ def add_user_route(app: FastAPI):
|
||||
access_token = CryptUtils.create_token(
|
||||
username=token_info.get("username"),
|
||||
type="access",
|
||||
expires_delta=timedelta(minutes=env.jwt_access_token_expire_minutes),
|
||||
expires_delta=timedelta(minutes=env.jwt_access_token_expire_seconds),
|
||||
)
|
||||
access_expires = env.jwt_access_token_expire_minutes * 60 * 1000
|
||||
access_expires = env.jwt_access_token_expire_seconds * 1000
|
||||
return {
|
||||
"access_token": access_token,
|
||||
"access_expires": access_expires,
|
||||
|
||||
Reference in New Issue
Block a user