MCPcopy Index your code
hub / github.com/fastapi-users/fastapi-users / _token

Function _token

tests/test_authentication_strategy_jwt.py:79–85  ·  view source on GitHub ↗
(user_id=None, lifetime=LIFETIME)

Source from the content-addressed store, hash-verified

77@pytest.fixture
78def token(jwt_strategy: JWTStrategy[UserModel, IDType]):
79 def _token(user_id=None, lifetime=LIFETIME):
80 data = {"aud": "fastapi-users:auth"}
81 if user_id is not None:
82 data["sub"] = str(user_id)
83 return generate_jwt(
84 data, jwt_strategy.encode_key, lifetime, algorithm=jwt_strategy.algorithm
85 )
86
87 return _token
88

Callers

nothing calls this directly

Calls 1

generate_jwtFunction · 0.90

Tested by

no test coverage detected