UNPKG

sfcc-dev-mcp

Version:

MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools

51 lines 1.71 kB
/** * OAuth Token Manager for SFCC OCAPI * * This module provides a singleton Token class that manages OAuth 2.0 access tokens * for SFCC OCAPI requests. It handles automatic token refresh when tokens expire. */ import { OAuthTokenResponse } from '../../types/types.js'; /** * Singleton class for managing OAuth tokens * Handles token storage, expiration checking, and automatic refresh */ export declare class TokenManager { private static instance; private tokens; private constructor(); /** * Get the singleton instance of TokenManager */ static getInstance(): TokenManager; /** * Generate a unique key for the token based on hostname and client ID */ private getTokenKey; /** * Check if a token is valid (exists and not expired) * Includes a 60-second buffer to avoid using tokens that are about to expire */ isTokenValid(hostname: string, clientId: string): boolean; /** * Get a valid token for the given hostname and client ID * Returns null if no valid token exists */ getValidToken(hostname: string, clientId: string): string | null; /** * Store a new token from the OAuth response */ storeToken(hostname: string, clientId: string, tokenResponse: OAuthTokenResponse): void; /** * Clear a token (useful for testing or when a token becomes invalid) */ clearToken(hostname: string, clientId: string): void; /** * Clear all tokens */ clearAllTokens(): void; /** * Get token expiration time for debugging purposes */ getTokenExpiration(hostname: string, clientId: string): Date | null; } //# sourceMappingURL=oauth-token.d.ts.map