ScuteSignIn is the whole sign-in as one component: the email field, then a passkey, a magic link or a 6-digit code as the app is set up, MFA, and a passkey offer for next time. It brings its own scoped stylesheet: no CSS import, no Tailwind, no bundler setup. It needs React 18 or 19 and an AuthContextProvider above it.
npm install @scute/auth-ui-react@next @scute/react-hooks@next"use client";import { useRouter } from "next/navigation";import { ScuteSignIn } from "@scute/auth-ui-react";export default function SignInPage() { const router = useRouter(); return ( <ScuteSignIn appearance={{ logo: "/logo.svg", accentColor: "#0f766e", theme: "auto" }} copy={{ title: "Sign in to Acme" }} legal={{ termsUrl: "/terms", privacyUrl: "/privacy" }} methods={{ google: true }} onSignedIn={() => router.replace("/dashboard")} /> );}Render it (or ScuteAuthGate) on the app's callback URL too: it reads sct_magic or sct_oauth from the address, removes it, and finishes the sign-in.
Props#
| Prop | Type | Default | |
|---|---|---|---|
| appearance.logo | ReactNode | string | none | An element, or an image URL. |
| appearance.accentColor | CSS color | near-black (light), near-white (dark) | Primary button and focus color. The button text picks black or white for contrast. |
| appearance.theme | "light" | "dark" | "auto" | "light" | "auto" follows the system setting. |
| appearance.radius | "none" | "small" | "medium" | "large" | "medium" | Corners of fields, buttons, code boxes and the card. |
| appearance.fontFamily | string | inherited | A CSS font-family. |
| appearance.illustration | ReactNode | false | a small icon per step | Your own element above the step, or false for none. |
| appearance.layout | "page" | "fill" | "card" | "page" | "page" is the window's height; "fill" sizes to its container (a panel, a modal); "card" is a panel inside your page. |
| appearance.className | string | none | A class on the root element. |
| copy.title | string | "Sign in" | First step's title. |
| copy.subtitle | string | "Enter your email and we will send you a link or a code. No account yet? This makes one." | First step's lead. |
| copy.emailLabel | string | "Email" | |
| copy.emailPlaceholder | string | "name@company.com" | |
| copy.continueLabel | string | "Continue" | |
| legal.termsUrl, legal.privacyUrl | string | none | Links under the form. The line shows when either is set. |
| methods.google | boolean | false | Adds "Continue with Google". Set Google up for the app first. |
| defaultEmail | string | none | The email the field starts with. "Use a different email" starts empty. |
| showLastUsed | boolean | true | Tag the way this browser last signed in "Last used" when the first step offers more than one way. Kept in localStorage; nothing is sent. |
| preview | AuthFlowView | ScuteSignInPreview | none | Draw one step with sample data. See Previews. |
| onSignedIn | (user) => void | none | Called once each time someone finishes signing in. |
The first step asks for what the app accepts (its allowed_identifiers): an email, a phone number, or either.
What it handles#
- Resend of the link or the code, once every 30 seconds (RESEND_COOLDOWN_SECONDS).
- Polling while a magic link is open elsewhere, so opening it on another device signs this page in.
- Attack protection's code step, after which the same link signs in.
- MFA with an authenticator app, an email or SMS code, or a backup code, switching between the user's methods, and "Trust this device for N days" (off until ticked) when the app allows it.
- Setting up a required factor during sign-in, the grace period nudge, and confirming an email or phone.
- Clear refusals: user_banned, user_suspended, ip_blocked, country_blocked and security_block each get their own message, and every error step has a way back.
- Settings that do not load (a wrong app ID, no connection): an error step with "Try again".
- Labelled fields, focus moved to each step's title, live status lines, and full keyboard use of the code boxes.
Theming with CSS#
The root element (.scute-signin) is drawn with CSS variables you can set in your own CSS:
.my-sign-in { --scute-bg: #fafafa; /* page background (layout "page") */ --scute-panel: #ffffff; /* fields, card */ --scute-line: #e4e4e7; /* borders */ --scute-ink-strong: #18181b; /* titles, field text */ --scute-ink-muted: #52525b; /* leads */ --scute-ink-soft: #71717a; /* hints, links */ --scute-bad: #b91c1c; /* errors */ --scute-accent: #4338ca; /* primary button */ --scute-accent-ink: #ffffff; /* primary button text */}The stylesheet is an inline <style> element and the theme uses inline CSS variables, so a Content Security Policy without 'unsafe-inline' in style-src blocks them.
Your own illustration#
useScuteSignInStep() returns { view, mood, errorCount } inside the component. mood is "idle", "working", "checking", "locked", "error" or "success"; errorCount goes up with each failed attempt.
import { ScuteSignIn, useScuteSignInStep } from "@scute/auth-ui-react";function Mascot() { const { mood, errorCount } = useScuteSignInStep(); return <MyMascot key={errorCount} mood={mood} />;}<ScuteSignIn appearance={{ illustration: <Mascot /> }} />;Last used#
getLastUsedMethod() returns the way this browser last finished signing in ("email", "phone", "passkey", "sso" or an OAuth provider such as "google"), or null. Call markLastUsedMethod("sso") before a sign-in your page starts itself, so it is tagged next time.
Previews#
preview draws one step with sample data and runs nothing: no client or provider needed, no requests, no focus taken, buttons that do nothing and codes that are never accepted. Use it for a settings preview, docs or screenshots.
<ScuteSignIn preview="login" appearance={{ layout: "fill" }} copy={{ title: "Sign in to Acme" }} /><ScuteSignIn preview={{ view: "otp_input", email: "ada@acme.com", error: "Invalid code" }} /><ScuteSignIn preview={{ view: "mfa_verify", mfaMethod: "totp", mfaMethods: ["totp", "email_otp", "backup_code"], deviceTrustDays: 30 }} /><ScuteSignIn preview={{ view: "error", errorCode: "ip_blocked" }} />ScuteSignInPreview fields: view (required), email, error, errorCode, mfaMethod ("totp" default, "email_otp", "sms_otp", "backup_code"), mfaMethods, mfaFactorNotAllowed, verificationMethod ("email_otp" default or "sms_otp"), mfaGraceDaysRemaining, deviceTrustDays, lastUsed. The views are listed on ScuteAuthGate and useScuteAuthFlow.