Pydantic model representing a persisted OAuth token record with helper methods for expiration.
# Source: https://github.com/lastmile-ai/mcp-agent | 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.
"""Shared record types for OAuth token management."""
from __future__ import annotations
from datetime import datetime, timezone
from typing import Any, Dict, Tuple
from pydantic import BaseModel, Field
class TokenRecord(BaseModel):
"""Persisted token bundle for a user/resource/authorization server combination."""
access_token: str
refresh_token: str | None = None
scopes: Tuple[str, ...] = ()
expires_at: float | None = None
token_type: str = "Bearer"
resource: str | None = None
authorization_server: str | None = None
obtained_at: float = Field
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key