SEQN Auth JS Quickstart
The SDK is dependency-free ESM and works in modern browsers, Node 20+, Bun, and Deno runtimes that provide fetch.
One-prompt setup for an IDE or agent
Create or open a project in the hosted console, then give the agent this endpoint:
https://accounts.seqn.in/v1/setup/agent-context?publishable_key=pk_live_your_project_key&framework=nextjs
The response includes install commands, env names, redirect URLs, JavaScript origins, hosted route URLs, and the shared-development Google OAuth mode. It intentionally does not include secret keys; copy the one-time project secret from the console or rotate it there when a backend needs SEQN_AUTH_SECRET_KEY.
From the SDK:
const setup = await auth.loadAgentSetupContext({ framework: "nextjs" });
console.log(setup.aiAgentPrompt);
Install
When published:
npm install @seqn/auth-js
Subpath helpers are available without adding runtime dependencies to the core SDK:
import { createSeqnAuthClient, createHostedAuthUrls } from "@seqn/auth-js";
import { createSeqnAuthReact } from "@seqn/auth-js/react";
import { createSeqnAuthNextHelpers } from "@seqn/auth-js/next";
import { createSeqnAuthExpressHelpers } from "@seqn/auth-js/express";
From this repo while the package is unpublished:
cd D:\sil\packages\seqn-auth-js
npm test
Use the core client:
import { createSeqnAuthClient, createHostedAuthUrls } from "./packages/seqn-auth-js/src/index.js";
const auth = createSeqnAuthClient({
baseUrl: "https://accounts.seqn.in",
publishableKey: "pk_live_your_project_key"
});
const config = await auth.loadPublicConfig();
const hosted = createHostedAuthUrls({
baseUrl: "https://accounts.seqn.in",
config,
returnTo: "https://app.example.com/dashboard"
});
console.log(config.application.name);
console.log(hosted.signInUrl);
Verify backend key health
Run the smoke check without deploying anything:
cd D:\sil\packages\seqn-auth-js
$env:SEQN_AUTH_BASE_URL="https://accounts.seqn.in"
$env:SEQN_AUTH_PUBLISHABLE_KEY="pk_live_your_project_key"
$env:SEQN_AUTH_SECRET_KEY="sk_live_your_project_secret"
npm run smoke
Equivalent JS:
import { createSeqnAuthClient } from "./packages/seqn-auth-js/src/index.js";
const auth = createSeqnAuthClient({
baseUrl: "https://accounts.seqn.in",
publishableKey: process.env.SEQN_AUTH_PUBLISHABLE_KEY,
secretKey: process.env.SEQN_AUTH_SECRET_KEY
});
const publicConfig = await auth.loadPublicConfig();
const backendHealth = await auth.verifyBackendKeyHealth();
console.log({ publicConfig, backendHealth });
Browser usage
<script type="module">
import { createSeqnAuthClient, createHostedAuthUrls } from "/vendor/seqn-auth-js/index.js";
const auth = createSeqnAuthClient({
baseUrl: "https://accounts.seqn.in",
publishableKey: "pk_live_your_project_key"
});
const config = await auth.loadPublicConfig();
const hosted = createHostedAuthUrls({ config, returnTo: window.location.href });
document.documentElement.dataset.authApplication = config.application.slug;
document.querySelector("[data-sign-in]").href = hosted.signInUrl;
</script>
Never ship sk_live_ keys to browsers. Use secret keys only from trusted backend or operations environments.