Socket
Book a DemoInstallSign in
Socket

@kohost/api-client

Package Overview
Dependencies
Maintainers
2
Versions
315
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kohost/api-client

API client, models, schemas, commands, and events for Kohost applications

4.8.5
latest
Source
npmnpm
Version published
Weekly downloads
319
60.3%
Maintainers
2
Weekly downloads
 
Created
Source

npm version Use Case Synced

Kohost API Client

Kohost API Client is a Node.js and Browser library for interacting with the Kohost API. It provides a simple and convenient way to access the API, as well as standard models, schemas, commands, and events.

Installation

npm install @kohost/api-client

Usage

The library consists of several modules, including:

  • Models: Defines the models used in the API.
  • Errors: Defines the error objects returned by the API.
  • Commands: Defines the available commands for managing hosting resources.
  • Events: Defines the events emitted by the API.
  • defs: Defines the API endpoint definitions.
  • utils: Contains utility functions.
  • Client: The main http client for interacting with the API
import { Client } from "@kohost/api-client";

const kohost = new Client({
  url: "https://localhost:8080/v3",
  propertyId: "development",
});

Authentication

Currently, the only supported mode of Authentication with the API is via an HTTP Only cookie. You can login a user via the following command to get a cookie.

Requesting a Login Token

const email = "help@kohost.io";

await kohost.RequestLoginLink({
  data: { email },
});

/** OR via Phone **/

const phone = "+17025555555";

await kohost.RequestLoginLink({
  data: { phone },
});

Click the link in the email or SMS to authenticate.

Using a Token

Simply use the LoginUser use case to provide a user ID via the sub parameter, along with the token parameter.

const sub = "user-id-from-api";
const token = "token-provided-by-api";

await kohost.LoginUser({
  data: { sub, token },
});

A successful response will set an HTTP only cookie in the browser.

FAQs

Package last updated on 04 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.