@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
Markdown
Entity Auth client SDK for web/Node.
```bash
pnpm add @entityauth/auth-client
```
```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();
```
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.
See repo docs for complete reference: Auth, Users, Orgs, Sessions, and Helpers.