UNPKG

@entityauth/auth-client

Version:

TypeScript/JavaScript client SDK for Entity Auth - complete authentication infrastructure with organizations, sessions, and real-time security

34 lines (21 loc) 890 B
# @entityauth/auth-client Entity Auth client SDK for web/Node. ## Install ```bash pnpm add @entityauth/auth-client ``` ## Usage ```ts import { EntityAuthClient } from '@entityauth/auth-client'; const ea = new EntityAuthClient({ baseURL: 'https://api.example.com' }); await ea.register({ email: 'a@b.com', password: 'secret', tenantId: 't1' }); await ea.login({ email: 'a@b.com', password: 'secret', tenantId: 't1' }); const me = await ea.getUserMe(); // Sessions await ea.getCurrentSession(); await ea.listSessions(); ``` ### Cross-origin note (web) The SDK sends `fetch` requests with `credentials: 'include'` so cookies can be used across origins. For cross-origin deployments, ensure your API sets the refresh cookie with `SameSite=None; Secure` and that CORS allows credentials. ## API Surface See repo docs for complete reference: Auth, Users, Orgs, Sessions, and Helpers.