@hvt/sdk
v0.1.3
Published
Zero-dependency fetch client for the HVT Authentication API.
Maintainers
Readme
HVT TypeScript SDK
Zero-dependency frontend and server SDK for HVT.
This repository contains the standalone TypeScript client for the HVT authentication platform.
- Main app: hvts.app
- Direct API base URL: api.hvts.app
- Docs: docs.hvts.app
- Backend API and platform code: markodera/hvt
- SDK issues: markodera/hvt-sdk/issues
Install
npm install @hvt/sdkLocal Build
From the repository root:
node ./scripts/build.mjsThe build copies src/index.js and src/index.d.ts into dist/.
Usage
import { HVTClient } from "@hvt/sdk";
const client = new HVTClient({
baseUrl: "http://localhost:8000",
});
const session = await client.auth.login({
email: "[email protected]",
password: "password123",
});
client.setAccessToken(session.access);
const org = await client.organizations.current();
const users = await client.users.list({ page_size: 25 });Runtime Auth with API Keys
const client = new HVTClient({
baseUrl: "http://localhost:8000",
apiKey: "hvt_test_xxx",
});
const providers = await client.runtime.socialProviders();
const session = await client.runtime.login({
email: "[email protected]",
password: "password123",
});Development Notes
- JWT takes priority over
X-API-Keyif both are sent. Do not send both at once. - Cookie auth is supported. The client defaults to
credentials: "include". - Runtime auth requires the
auth:runtimescope. - Failed refreshes clear the in-memory access token and dispatch
auth:logoutby default so apps can react consistently. - If you are integrating from a language without an SDK, call the HTTP API directly at
https://api.hvts.app.
License
AGPL-3.0-only. See LICENSE.
