@subsidia-ch/sdk - v1.3.5
    Preparing search index...

    Main authentication controller Handles token lifecycle and authentication for API calls

    Index

    Constructors

    • Parameters

      • __namedParameters: {
            config: AuthConfig;
            environment: Environment;
            fetchService: FetchService;
            getCachedToken?: () => Promise<null | string>;
            setCachedToken?: (tokenDataJSON: string) => Promise<void>;
            tokenStore?: TokenStore;
        }

      Returns AuthController

    Methods

    • Execute function with authentication Will automatically refresh token and retry once if auth fails

      Type Parameters

      • T

      Parameters

      • __namedParameters: {
            fn: (authHeader: string) => Promise<T>;
            options?: { retryOnUnauthorized?: boolean };
        }

      Returns Promise<T>

    • Get access token (refreshing if needed)

      Parameters

      • __namedParameters: { forceRefresh: boolean }

      Returns Promise<string>

    • Get authorization header for API requests

      Returns Promise<string>

    • Get access token (refreshing if needed)

      Returns Promise<void>