@onjunctiondev/auth
v0.3.0
Published
Headless auth SDK for Junction — email/password sessions with per-project JWTs and RLS claims.
Readme
@onjunctiondev/auth
Headless auth SDK for Junction. Email/password sign-up, sign-in, sessions, and token refresh — talks to a per-project Junction auth service.
Zero UI. Bring your own form.
Install
npm install @onjunctiondev/authUsage
import { createJunctionClient } from "@onjunctiondev/auth";
const junction = createJunctionClient({
url: process.env.JUNCTION_URL!, // e.g. https://abc123.onjunction.dev
});
// All methods return { data, error } — they never throw across the API
// boundary.
const { data, error } = await junction.auth.signUp({
email: "[email protected]",
password: "correct-horse-battery-staple",
});
if (error) {
console.error(error.message);
} else {
console.log("signed up:", data.session.user.id);
}Methods
junction.auth.signUp({ email, password });
junction.auth.signIn({ email, password });
junction.auth.signOut();
junction.auth.getSession();
junction.auth.getUser();
junction.auth.refreshSession();
junction.auth.onAuthStateChange((event, session) => { /* ... */ });Status
Slice 1 — core client only. React hooks (/react) and Next.js server
helpers (/server) throw a clear "coming soon" error on import; they
ship with slices 2 and 3.
License
MIT
