• Type Parameters

    Parameters

    • param: {
          config: OidcConfig;
          logger?: {
              custom?: CustomLogger;
              level: "none" | "error" | "warn" | "info" | "debug";
          };
          requestMiddleware?: RequestMiddleware<ActionType>[];
          storage?: Partial<StorageConfig>;
          store?: SdkStore;
      }

      configuration object containing the OIDC client configuration, request middleware, logger,

      • config: OidcConfig

        OIDC configuration including server details, client ID, redirect URI, storage options, scope, and response type.

      • Optionallogger?: { custom?: CustomLogger; level: "none" | "error" | "warn" | "info" | "debug" }

        optional logger configuration with log level and custom logger.

      • OptionalrequestMiddleware?: RequestMiddleware<ActionType>[]

        optional array of request middleware functions to process requests.

      • Optionalstorage?: Partial<StorageConfig>

        optional storage configuration for persisting OIDC tokens.

      • Optionalstore?: SdkStore

        An existing SDK store to attach to, so discovery caching and state are shared with another client. Omit to create a store for this client alone.

    Returns Promise<
        | {
            authorize?: undefined;
            error: string;
            subscribe?: undefined;
            token?: undefined;
            type: string;
            user?: undefined;
        }
        | {
            authorize: {
                background: (
                    options?: GetAuthorizationUrlOptions,
                ) => Promise<AuthorizationSuccess | AuthorizationError>;
                url: (
                    options?: GetAuthorizationUrlOptions,
                ) => Promise<string | GenericError>;
            };
            error?: undefined;
            subscribe: (listener: ListenerCallback) => Unsubscribe;
            token: {
                exchange: (
                    code: string,
                    state: string,
                    options?: Partial<StorageConfig>,
                ) => Promise<OauthTokens | GenericError | TokenExchangeErrorResponse>;
                get: (
                    options?: GetTokensOptions,
                ) => Promise<
                    | OauthTokens
                    | GenericError
                    | TokenExchangeErrorResponse
                    | AuthorizationError,
                >;
                revoke: () => Promise<
                    GenericError
                    | RevokeSuccessResult
                    | RevokeErrorResult,
                >;
            };
            type?: undefined;
            user: {
                info: () => Promise<GenericError | UserInfoResponse>;
                logout: () => Promise<
                    GenericError
                    | LogoutErrorResult
                    | LogoutSuccessResult,
                >;
                session: (
                    options?: SessionCheckOptions,
                ) => Promise<GenericError | SessionCheckSuccess>;
            };
        },
    >

    • Returns an object with methods for authorization, token exchange, user info retrieval, and logout.

    oidc

    Factory function to create an OIDC client with methods for authorization, token exchange, user info retrieval, and logout. It initializes the client with the provided configuration, request middleware, logger, and storage options.