Put in order · Python course · Module 6: Async and FastAPI

Creating a JWT token

Arrange the function for creating a JWT token:

Items to put in order

  • return jwt.encode(to_encode, SECRET_KEY, algorithm='HS256')
  • to_encode = data.copy()
  • to_encode.update({'exp': expire})
  • def create_access_token(data: dict):
  • expire = datetime.now(timezone.utc) + timedelta(minutes=15)

You can check the correct answer by solving this task in the CodeWorlds game.