@squidcloud/client
    Preparing search index...

    Class ExternalAuthClient

    Client for managing authentication tokens for external integrations.

    Provides methods for saving and retrieving auth tokens for external services.

    Index

    Methods

    • Retrieves a valid access token for the integration. Automatically refreshes the token if it has expired or is about to expire.

      This function requires Squid to be initialized with an API key

      Parameters

      • identifier: string

        The user-specific identifier that was used when saving the auth code.

      Returns Promise<GetAccessTokenResponse>

      A promise that resolves with a valid access token and its expiration time.

      Error if no tokens are found for the given integration and identifier. The user must first complete the auth flow by calling saveAuthCode().

    • Takes an auth token, potentially exchanges the auth token with an external api depending on the external auth, and stores the result in Squid's secure storage.

      This function requires Squid to be initialized with an API key

      Parameters

      • authCode: string

        The authorization code obtained from the auth provider's callback.

      • identifier: string

        A user-specific identifier (usually a user ID) to associate with the tokens. This allows multiple users to connect their own accounts to the same integration.

      Returns Promise<GetAccessTokenResponse>

      A promise that resolves with the access token and its expiration time.