FastAPI - Authentication and Security
Identify the error in this JWT token creation code snippet:
from jwt import encode
payload = {"user_id": 42}
secret = "secretkey"
token = encode(payload, secret)
print(token)