Handles OAuth authentication flow with Sapo API

Constructors

Methods

  • Complete OAuth flow by verifying callback and exchanging code for token

    Parameters

    • store: string

      Store name (e.g., 'your-store.mysapo.net')

    • callbackUrl: string

      Full callback URL from OAuth process

    Returns Promise<Token>

    Promise resolving to access token

    Throws

    If verification fails or token exchange fails

  • Exchange authorization code for access token

    Parameters

    • store: string

      Store name (e.g., 'your-store.mysapo.net')

    • code: string

      Authorization code from OAuth callback

    Returns Promise<Token>

    Promise resolving to access token

    Throws

    If token exchange fails

  • Generate OAuth authorization URL for user authentication

    Parameters

    Returns string

    Authorization URL to redirect users to

  • Parse OAuth callback URL and extract authorization code

    Parameters

    • url: string

      Full callback URL with query parameters

    Returns {
        code: string;
        hmac: string;
        timestamp: string;
    }

    Parsed callback parameters

    • code: string
    • hmac: string
    • timestamp: string

    Throws

    If required parameters are missing

  • Verify HMAC signature from Sapo

    Parameters

    Returns boolean

    Whether the signature is valid