link

JWT Authentication

JSON Web Token auth

security
jwt

Command

Examples

JWT token creation

from jose import JWTError, jwt
  
  SECRET_KEY = "secret"
  ALGORITHM = "HS256"
  
  def create_access_token(data: dict):
      to_encode = data.copy()
      return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)