JavaScript SDK

JavaScript SDK

The Scute packages for browsers, Node, React and Next.js, what each one is for, and how to install them.

The JavaScript SDK is a set of TypeScript packages. @scute/js-core is the client every other package builds on; the others add React state, Next.js cookies and route handlers, and ready-made sign-in UI.

Packages#

PackageVersionUse it for
@scute/js-core0.10.0-next.5The client for browsers and Node: every sign-in method, MFA, sessions, the signed-in user, permission checks, the verifications inbox, and ScuteAdminApi for server calls with the app's secret key.
@scute/react-hooks0.9.0-next.5AuthContextProvider, useAuth, MFA hooks, useCan, usePermissions, useImpersonation. Re-exports everything in @scute/js-core.
@scute/nextjs-handlers0.9.0-next.6Next.js 13 to 16, App and Pages Router, Node and Edge: one catch-all route handler, an httpOnly refresh cookie, CSRF checks, and clients for server components, route handlers, server actions and middleware. Re-exports everything in @scute/js-core.
@scute/auth-ui-react0.4.0-next.5<ScuteSignIn />, <ScuteAuthGate />, the headless useScuteAuthFlow, account hooks (profile, sessions, phones, MFA setup) and hooks for embeddable authorization admin screens.
create-scute-app0.3.0-next.0A CLI that adds Scute sign-in to an existing project.

Agent guardrails (@scute/harness) and the MCP gateway (@scute/mcp-gateway) have their own sections: Harness and AI agents.

Install#

The current releases are published under the next dist-tag. The latest tag points to an older release (0.8.0) that lacks most of what these pages describe, so install with @next.

npm install @scute/js-core@next

Pick the packages by where your code runs:

Your appInstall
Next.js@scute/nextjs-handlers@next @scute/react-hooks@next @scute/auth-ui-react@next
React (Vite, Remix, TanStack Start, Astro islands)@scute/react-hooks@next @scute/auth-ui-react@next
React Native, Vue, Svelte, plain browser JavaScript@scute/js-core@next (React Native: @scute/react-hooks@next)
Node server (Express, Fastify, node:http)@scute/js-core@next

React 16.8 to 19 works with @scute/react-hooks. @scute/auth-ui-react needs React 18 or later.

Credentials#

ValueWhere it goesNotes
App IDappId in the client config, or NEXT_PUBLIC_SCUTE_APP_ID for @scute/nextjs-handlersPublic. On the app's page in the dashboard.
Secret keysecretKey in the config, or SCUTE_SECRET for @scute/nextjs-handlersServer only. A client running in a browser ignores it, logs a warning and never sends it.
Base URLbaseUrl, or NEXT_PUBLIC_SCUTE_BASE_URLDefault https://api.scute.io.

Next steps#

Next.js quickstart
Route handler, provider and sign-in gate.
React quickstart
Provider and ScuteAuthGate in a Vite app.
JavaScript quickstart
@scute/js-core in the browser and on a Node server.
Client setup
createClient options, storage and defaults.