Skip to main content

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​

CapabilityStytchGate
Email magic linkmagic_links.email.login_or_create → magic_links.authenticategate.passwordless.requestMagicLink → gate.passwordless.verifyMagicLink
Email OTPotps.email.login_or_create → otps.authenticategate.passwordless.requestOtp → gate.passwordless.verifyOtp
SMS OTPotps.sms.login_or_create → otps.authenticateNot supported (SIM-swap risk; NIST 800-63B-4 deprecation)
WhatsApp OTPotps.whatsapp.login_or_createNot supported
Password sign-inpasswords.create / passwords.authenticategate.signIn({ email, password })
Password strength checkpasswords.strength_check (zxcvbn-backed)gate.passwords.strengthCheck (same zxcvbn substrate)
OAuthoauth.<provider>.authenticategate.signInWithProvider({ provider: 'google' }) → gate.completeSignIn()
SSO — OIDCsso.oidc.authenticateFederate via gate.signInWithProvider({ provider: 'saml' }) (generic OIDC is not supported)
SSO — SAMLsso.saml.authenticategate.signInWithProvider({ provider: 'saml' })
WebAuthnwebauthn.register / authenticateSee API → Auth §6
TOTPtotps.create / authenticateEnd-user TOTP enrollment: POST /@<projectSlug>/gate/mfa/totp/enroll and .../totp/confirm
Crypto wallet sign-incrypto_wallets.authenticateNot supported
SessionsSession tokens with configurable JWT issuanceRoot + tenant two-tier model; refresh tokens rotate on every refresh; see Session Model
Organizations / B2BB2B product line (Members + Organizations + SSO + SCIM)Kilimanjaro projects + RBAC roles + native AD/LDAP bridging cover the B2B surface
User managementStytch DashboardConsole (/admin/auth/members) + Gate Studio
WebhooksStytch webhooks for auth eventsWebhook subscriptions per Security §2.6
PricingMAU-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.

Stytch, one family per methodGate, one clientMagic link/v1/magic_links/emailEmail OTP/v1/otps/emailgate.passwordlessrequestMagicLink / verifyMagicLinkrequestOtp / verifyOtpPassword/v1/passwordsgate.signInemail and passwordOAuthauthenticate per providergate.signInWithProviderthen gate.completeSignIn()
Stytch's per-method families consolidate onto one Gate client with a method for each flow.

2. API-shape mapping​

// 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 fieldGate field
user_id (user-test-xxx)New Gate user ID; preserve old in customAttributes.stytch_user_id
emails[].emailemail (primary; secondary stored in customAttributes)
phone_numbers[].phone_numberphoneNumber
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_metadataMerge 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​

StepDone when
Capability auditEvery Stytch method family listed in §1 mapped to a Gate equivalent (or replanned)
Parallel-runGate provisioned alongside Stytch; sign-ups create in both; sign-ins try Gate first, fall back to Stytch
User-data exportStytch users exported via paginated users.search
User-data importgate.users.import against the target Gate project; dry-run passes
MFA re-enrollment window14-day window during parallel-run for WebAuthn + TOTP re-enrollment
Per-method consolidationPer-method Stytch SDK calls consolidated onto a single Gate client (signIn / passwordless.* / signInWithProvider)
Session-validation migrationResource servers verify against Gate's JWKS; Stytch session API removed
CutoverSign-ins routed Gate-only; Stytch webhooks disabled; Stytch project archived
DecommissionStytch subscription cancelled after a 30-day verification window

5. See also​