OAuth2ClientConfiguration (oauth2/schemas.py)

polar · server/polar/oauth2/schemas.py · python · Apache-2.0
auth, tag:embed-classified

Pydantic schemas for OAuth2 client configuration and token flows.

# Source: https://github.com/polarsource/polar | 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.
import ipaddress
from typing import Annotated, Any, Literal

from fastapi.openapi.constants import REF_TEMPLATE
from pydantic import (
    UUID4,
    AfterValidator,
    AnyUrl,
    BeforeValidator,
    Discriminator,
    EmailStr,
    Field,
    HttpUrl,
    TypeAdapter,
)

from polar.auth.scope import (
    SCOPES_SUPPORTED,
    SCOPES_SUPPORTED_DISPLAY_NAMES,
    Scope,
    scope_to_list,
)
from polar.kit.schemas import Schema, TimestampedSchema

from .sub_type import SubType


def _is_localhost(host: str) -> bool:
    try:
        return ipaddress.IPv4Address(host).is_private
    exce

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key