@mcp-z/oauth
    Preparing search index...

    Interface OAuth2TokenStorageProvider

    Base interface for stateful OAuth adapters (LoopbackOAuthProvider pattern)

    Stateful adapters manage token storage, refresh, and multi-account state. Used for local development, test setup, and CI/CD workflows.

    Key characteristics:

    • Token storage and retrieval via tokenStore
    • Automatic token refresh with provider
    • Interactive OAuth flows (browser, ephemeral server)
    • Multi-account management

    Parameter usage:

    • accountId: Account identifier (email address for token storage)
    interface OAuth2TokenStorageProvider {
        getAccessToken(accountId?: string): Promise<string>;
        getUserEmail(accountId?: string): Promise<string>;
    }
    Index

    Methods

    • Get access token for the specified account. If token is expired, automatically refreshes it. If token is missing, triggers OAuth flow (interactive) or throws AuthRequired (headless).

      Parameters

      • OptionalaccountId: string

        Account identifier for multi-account support

      Returns Promise<string>

      Access token string

    • Get email address for the specified account. Used during account registration to verify identity with provider.

      Parameters

      • OptionalaccountId: string

        Account identifier

      Returns Promise<string>

      Email address from provider verification