Authentication utility helpers.
# Source: https://github.com/PrefectHQ/fastmcp | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Authentication utility helpers."""
from __future__ import annotations
import base64
import json
from typing import Any
from fastmcp.utilities.logging import get_logger
logger = get_logger(__name__)
def _decode_jwt_part(token: str, part_index: int) -> dict[str, Any]:
"""Decode a JWT part (header or payload) without signature verification.
Args:
token: JWT token string (header.payload.signature)
part_index: 0 for header, 1 for payload
Returns:
Decoded part as a dictionary
Raises:
ValueError: If token is not a valid JWT format
"
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key