Migrating from Stytch to Gate
Stytch's positioning leans developer-API-first with a per-method SDK split — separate endpoint families for email magic links (/v1/magic_links/email), OTPs (/v1/otps/email), passwords (/v1/passwords), WebAuthn (/v1/webauthn), and OAuth. Gate exposes one client with a method per flow: gate.signIn for email + password, the gate.passwordless namespace (requestMagicLink/verifyMagicLink, requestOtp/verifyOtp) for the link / code path, and gate.signInWithProvider + gate.completeSignIn() for federated providers.
If you haven't already, read the migration overview for the four-phase migration arc that applies across all vendors.
1. Capability mapping
| Capability | Stytch | Gate |
|---|---|---|
| Email magic link | magic_links.email.login_or_create → magic_links.authenticate | gate.passwordless.requestMagicLink → gate.passwordless.verifyMagicLink |
| Email OTP | otps.email.login_or_create → otps.authenticate | gate.passwordless.requestOtp → gate.passwordless.verifyOtp |
| SMS OTP | otps.sms.login_or_create → otps.authenticate | Not supported (SIM-swap risk; NIST 800-63B-4 deprecation) |
| WhatsApp OTP | otps.whatsapp.login_or_create | Not supported |
| Password sign-in | passwords.create / passwords.authenticate | gate.signIn({ email, password }) |
| Password strength check | passwords.strength_check (zxcvbn-backed) | gate.passwords.strengthCheck (same zxcvbn substrate) |
| OAuth | oauth.<provider>.authenticate | gate.signInWithProvider({ provider: 'google' }) → gate.completeSignIn() |
| SSO — OIDC | sso.oidc.authenticate | Federate via gate.signInWithProvider({ provider: 'saml' }) (generic OIDC is not supported) |
| SSO — SAML | sso.saml.authenticate | gate.signInWithProvider({ provider: 'saml' }) |
| WebAuthn | webauthn.register / authenticate | See API → Auth §6 |
| TOTP | totps.create / authenticate | End-user TOTP enrollment: POST /@<projectSlug>/gate/mfa/totp/enroll and .../totp/confirm |
| Crypto wallet sign-in | crypto_wallets.authenticate | Not supported |
| Sessions | Session tokens with configurable JWT issuance | Root + tenant two-tier model; refresh tokens rotate on every refresh; see Session Model |
| Organizations / B2B | B2B product line (Members + Organizations + SSO + SCIM) | Kilimanjaro projects + RBAC roles + native AD/LDAP bridging cover the B2B surface |
| User management | Stytch Dashboard | Console (/admin/auth/members) + Gate Studio |
| Webhooks | Stytch webhooks for auth events | Webhook subscriptions per Security §2.6 |
| Pricing | MAU-based (B2C) + per-organization (B2B) | 50K MAU on Free; Unlimited on every paid tier; projects unlimited |
Stytch's per-method SDK split → Gate's one-client-with-a-method-per-flow surface is the largest shape change. If your Stytch integration spans multiple methods (magic link + password + OAuth, say), you'll consolidate the per-method client calls onto a single Gate client: gate.signIn for password, gate.passwordless.* for link / code, gate.signInWithProvider for federated.
2. API-shape mapping
2.1 Magic link
// Before — Stytch
import stytch from 'stytch';
const client = new stytch.Client({ project_id, secret });
// 1. Dispatch link
await client.magicLinks.email.loginOrCreate({
login_magic_link_url: 'https://app.example.com/auth/callback',
});
// 2. Authenticate on callback
const result = await client.magicLinks.authenticate({ token });
// After — Gate
import { createGateClient } from '@k9o/gate';
const gate = createGateClient({ mode: 'standalone', baseUrl: '...', projectSlug: '...' });
// 1. Dispatch link
await gate.passwordless.requestMagicLink({
redirectUrl: 'https://app.example.com/auth/callback',
});
// 2. Redeem the token on callback
const { data } = await gate.passwordless.verifyMagicLink({ token });
const accessToken = data.session.accessToken;
The shape is a one-to-one mapping; only the method names and the SDK surface organisation differ.
2.2 OTP
// Before — Stytch
await client.otps.email.loginOrCreate({ email });
const result = await client.otps.authenticate({ method_id, code });
// After — Gate
await gate.passwordless.requestOtp({ email });
const { data } = await gate.passwordless.verifyOtp({ email, code });
Stytch's method_id opaque handle is hidden inside the Gate OTP_REDEEM call; you pass email and code and Gate looks up the active dispatch internally.
2.3 Session validation
// Before — Stytch
const result = await client.sessions.authenticate({ session_token });
// After — Gate (standalone verifyJwt; narrow on .valid, no data envelope)
import { verifyJwt } from "@k9o/gate";
const result = await verifyJwt({
token: accessToken,
jwksUrl: "https://<org>.api.k9o.io/@<proj>/auth/jwks",
allowedAlgorithms: ['EdDSA', 'RS256', 'ES256'],
expectedIssuer: issuer, // the iss claim of your Gate tokens
expectedAudience: projectId, // end-user tokens: aud is the project id
});
if (result.valid) { /* result.claims */ }
Gate's access token is a standard JWT verifiable through the per-project JWKS endpoint at <orgSlug>.api.k9o.io/@<projectSlug>/auth/jwks — no SDK-side round-trip to the gateway beyond fetching the keys is required for verification on a resource server. The JWKS response is wrapped in the standard { data: { keys } } envelope; verifyJwt unwraps it.
3. User-data migration
Export users from Stytch via their users.search API (paginated). Field mapping:
| Stytch field | Gate field |
|---|---|
user_id (user-test-xxx) | New Gate user ID; preserve old in customAttributes.stytch_user_id |
emails[].email | email (primary; secondary stored in customAttributes) |
phone_numbers[].phone_number | phoneNumber |
password hash (bcrypt / scrypt) | Importable via gate.users.import with hasher metadata; users sign in without reset |
providers[] (OAuth links) | Re-link via the project's Console IdP configuration; users re-consent on first sign-in |
webauthn_registrations[] | Re-enrollment required (WebAuthn credentials are platform-scoped; new project = new registration) |
totps[] | Re-enrollment required (TOTP secrets cannot transfer across identity providers) |
trusted_metadata + untrusted_metadata | Merge into customAttributes; apply your own trust posture through Controls |
WebAuthn + TOTP re-enrollment is the main user-visible friction in a Stytch → Gate migration. Plan a 14-day window during the parallel-run phase where users re-enroll their MFA factors; surface a Console-side reminder for users who haven't re-enrolled at cutover.
4. Cutover checklist
| Step | Done when |
|---|---|
| Capability audit | Every Stytch method family listed in §1 mapped to a Gate equivalent (or replanned) |
| Parallel-run | Gate provisioned alongside Stytch; sign-ups create in both; sign-ins try Gate first, fall back to Stytch |
| User-data export | Stytch users exported via paginated users.search |
| User-data import | gate.users.import against the target Gate project; dry-run passes |
| MFA re-enrollment window | 14-day window during parallel-run for WebAuthn + TOTP re-enrollment |
| Per-method consolidation | Per-method Stytch SDK calls consolidated onto a single Gate client (signIn / passwordless.* / signInWithProvider) |
| Session-validation migration | Resource servers verify against Gate's JWKS; Stytch session API removed |
| Cutover | Sign-ins routed Gate-only; Stytch webhooks disabled; Stytch project archived |
| Decommission | Stytch subscription cancelled after a 30-day verification window |
5. See also
- Migration overview — the four-phase migration arc.
- Gate API → Auth — the full Gate SDK surface.
- Pricing — Gate pricing model.