Package Exports
- @entityauth/auth-client
- @entityauth/auth-client/auth
- @entityauth/auth-client/client
- @entityauth/auth-client/config
- @entityauth/auth-client/convex
- @entityauth/auth-client/graphql
- @entityauth/auth-client/http
- @entityauth/auth-client/organizations
- @entityauth/auth-client/sdk
- @entityauth/auth-client/sessions
- @entityauth/auth-client/users
Readme
@entityauth/auth-client
Entity Auth client SDK for web/Node.
Install
pnpm add @entityauth/auth-clientUsage
import { EntityAuthClient, init as initEA, SDK } from '@entityauth/auth-client';
initEA({
workspaceTenantId: process.env.NEXT_PUBLIC_ENTITY_AUTH_WORKSPACE_TENANT_ID!,
baseURL: process.env.NEXT_PUBLIC_ENTITY_AUTH_URL,
});
const ea = new EntityAuthClient();
await SDK.register({ email: 'a@b.com', password: 'secret' });
await SDK.login({ email: 'a@b.com', password: 'secret' });
const me = await ea.getUserMe();
// Sessions
await SDK.getCurrentSession();
await SDK.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.