diff --git a/main.py b/main.py index 3cef117..a5f94c2 100644 --- a/main.py +++ b/main.py @@ -70,6 +70,8 @@ async def global_auth(request: Request): app = FastAPI() +access_tokens = [] + def generate_access_token(username: str, password: str) -> str: """ 根据用户名和密码生成JWT access token @@ -100,7 +102,10 @@ def generate_access_token(username: str, password: str) -> str: } # 生成并返回JWT token - return jwt.encode(payload, SECRET_KEY, algorithm=ALGORITHM) + token = jwt.encode(payload, SECRET_KEY, algorithm=ALGORITHM) + access_tokens.append(token) + + return token