MCPcopy Create free account
hub / github.com/Tong89/smartNode / create_token

Function create_token

backend/auth.py:44–47  ·  view source on GitHub ↗
(sub, role, token_type, ttl)

Source from the content-addressed store, hash-verified

42
43
44def create_token(sub, role, token_type, ttl):
45 now = int(time.time())
46 payload = {"sub": sub, "role": role, "type": token_type, "iat": now, "exp": now + ttl}
47 return jwt.encode(payload, jwt_secret(), algorithm=JWT_ALGORITHM)
48
49
50def create_access_token(sub, role):

Callers 2

create_access_tokenFunction · 0.85
create_refresh_tokenFunction · 0.85

Calls 1

jwt_secretFunction · 0.85

Tested by

no test coverage detected