mirror of
https://github.com/mizhexiaoxiao/vue-fastapi-admin.git
synced 2026-09-24 05:46:24 +00:00
11 lines
297 B
Python
11 lines
297 B
Python
import jwt
|
|
|
|
from app.schemas.login import JWTPayload
|
|
from app.settings.config import settings
|
|
|
|
|
|
def create_access_token(*, data: JWTPayload):
|
|
payload = data.model_dump().copy()
|
|
encoded_jwt = jwt.encode(payload, settings.SECRET_KEY, algorithm=settings.JWT_ALGORITHM)
|
|
return encoded_jwt
|