Skip to main content
Glama
by cycodehq
jwt_utils.pyโ€ข537 B
from typing import Optional import jwt _JWT_PAYLOAD_POSSIBLE_USER_ID_FIELD_NAMES = ('userId', 'internalId', 'token-user-id') def get_user_and_tenant_ids_from_access_token(access_token: str) -> tuple[Optional[str], Optional[str]]: payload = jwt.decode(access_token, options={'verify_signature': False}) user_id = None for field in _JWT_PAYLOAD_POSSIBLE_USER_ID_FIELD_NAMES: user_id = payload.get(field) if user_id: break tenant_id = payload.get('tenantId') return user_id, tenant_id

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cycodehq/cycode-cli'

If you have feedback or need assistance with the MCP directory API, please join our Discord server