JavaScript core
TypeScript@identra/jsThe framework-agnostic, headless engine every UI SDK is built on. Use it directly anywhere.
Install
pnpm add @identra/jsCreate a client
ts
import { createIdentra } from "@identra/js";
const identra = createIdentra({
baseUrl: "http://localhost:8080",
applicationId: APP_ID, // publishable — safe in the browser
});
const unsubscribe = identra.subscribe((state) => {
// state.user / state.isSignedIn / state.isLoaded
});Run the flows
ts
// Password
await identra.signUpWithPassword({ email, password });
await identra.signInWithPassword({ email, password });
// Passwordless (email code or magic link)
const { verification_id } = await identra.startEmailOtp(email);
await identra.verify({ verification_id, code });
// Social — open this URL in a browser / WebView
const url = identra.oauthStartUrl("google", redirectUrl);
// Session
identra.getToken(); // current access token, for calling your own backend
await identra.refresh(); // rotate the refresh token
await identra.signOut();API
createIdentra()subscribe()getToken()signInWithPassword()startEmailOtp()verify()oauthStartUrl()refresh()signOut()IdentraError