• Type Parameters

    Parameters

    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.