• Type Parameters

    Parameters

    • raw: RawOidcArgs<ActionType>

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

      • config: OidcConfig
      • Optionallogger?: { custom?: CustomLogger; level: LogLevel }
      • OptionalrequestMiddleware?: RequestMiddleware<ActionType>[]
      • Optionalstorage?: Partial<StorageConfig>
      • Optionalstore?: unknown

        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. Typed as unknown — the parser validates this at runtime via isSdkStoreHandle.

    Returns Promise<
        | GenericError
        | {
            authorize?: undefined;
            error: string;
            store?: undefined;
            subscribe?: undefined;
            token?: undefined;
            type: string;
            user?: undefined;
        }
        | {
            authorize: {
                background: (
                    options?: GetAuthorizationUrlOptions,
                ) => Promise<AuthorizationSuccess | AuthorizationError>;
                url: (
                    options?: GetAuthorizationUrlOptions,
                ) => Promise<string | GenericError>;
            };
            error?: undefined;
            store: SdkStore;
            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.