Quick Start
Authenticate users using the Tzylo Auth CE SDK.
This guide shows how to use Tzylo Auth CE from an application using the official SDK.
The SDK handles access tokens, refresh cookies, and headers automatically, so you can focus on application logic.
Install SDK
Install
npm install @tzylo/auth-ceInitialize Client
auth.ts
import { TzyloAuth } from "@tzylo/auth-ce";
export const auth = new TzyloAuth({
baseURL: "http://localhost:7200",
});Register a User
Register
await auth.auth.register(
"test@example.com",
"password123"
);Login
Login
await auth.auth.login(
"test@example.com",
"password123"
);The SDK stores the access token in memory and relies on an HTTP-only refresh cookie managed by the backend.
Get Current User
Get profile
const me = await auth.auth.me();
console.log(me);Logout
Logout
await auth.auth.logout();What the SDK handles
- Attaching
Authorizationheaders - Access token storage (in-memory)
- Refresh token cookies (
credentials: include) - Token refresh via
/refresh
Next Steps
- Enable OTP and password reset flows
- Configure Redis for production
- Use middleware in your backend services
- Explore example apps in the repository