• Type Parameters

    Parameters

    • param: {
          config: OidcConfig;
          logger?: { custom?: CustomLogger; level: LogLevel };
          requestMiddleware?: RequestMiddleware<ActionType>[];
          storage?: Partial<StorageConfig>;
      }

      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: LogLevel }

        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.

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

    • 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.