chore(dev): update dev environment
This commit is contained in:
@@ -156,11 +156,10 @@ def create_access_token(data: dict, expires_delta: timedelta | None = None) -> s
|
||||
expire = utcnow() + timedelta(minutes=settings.access_token_expire_minutes)
|
||||
|
||||
# 添加标准JWT声明
|
||||
to_encode.update({"exp": expire, "random": secrets.token_hex(16)})
|
||||
if hasattr(settings, "jwt_audience") and settings.jwt_audience:
|
||||
to_encode.update({"exp": expire, "jti": secrets.token_hex(16)})
|
||||
if settings.jwt_audience:
|
||||
to_encode["aud"] = settings.jwt_audience
|
||||
if hasattr(settings, "jwt_issuer") and settings.jwt_issuer:
|
||||
to_encode["iss"] = settings.jwt_issuer
|
||||
to_encode["iss"] = str(settings.server_url)
|
||||
|
||||
# 编码JWT
|
||||
encoded_jwt = jwt.encode(to_encode, settings.secret_key, algorithm=settings.algorithm)
|
||||
|
||||
Reference in New Issue
Block a user