Skip to content

LM-01Authentication

Every sign-in method, taken apart.

Passkeys, email codes, magic links, social accounts, enterprise single sign-on and a second factor ship in the same component. This chapter shows what each one puts on the wire, where it is strong and where it is not.

Title
Authentication
Doc. no.
LM-01
Rev.
04
Issued
Nov 2026
Sheet
1 of 4

1.0Passkeys

Passkeys: a key pair instead of a secret.

A passkey is a private key that never leaves the user's device and a public key that Latch stores. Signing in means signing a random challenge. There is no shared secret to phish, leak or reset.

Ceremony

Algorithms
ES256, EdDSA
User verification
Required
Synced passkeys
Accepted
Passkeys per user
20
Fallback
Email code
Caution
Do not change your relying-party ID after launch. Every passkey is bound to it: moving sign-in from acme.dev to login.acme.io orphans all of them at once.
WebAuthn · registrationrp.id acme.dev
Authenticator
Browser
Latch
  1. The component asks Latch to start a registration for the signed-in user. Nothing about the device is sent yet.

Step 1 of 8

Fig. 1.1The WebAuthn ceremony between the authenticator, the browser and Latch. Step through it, or press play.

On the wire at step 1

POST /v1/passkeys/register/options
{  "user_id": "usr_2f8c41d07a",  "authenticator": "platform"}

2.0Email

Email codes and magic links, with the inbox in view.

The most familiar way in, and the fallback for every other method. Type an address on the left and watch the message arrive on the right: the same template, timing and limits your users get.

app.acme.dev/sign-in

Sign in to Acme

Any address works. The message lands in the inbox belowon the right.

mail.example/inboxInbox
  • Nothing from Acme yet. Send a code.
Fig. 2.1The sign-in step in your app, and the user's inbox next to it. Send a code, open the message, type it back.
Code length
6 digits
Lifetime
10 minutes
Attempts per code
5
Resend after
30 seconds
Magic link
Single use
Median delivery
2.4 s

Send as

Your sender Messages leave from your domain with your DKIM key. Latch's name appears nowhere in the inbox.

The code Six digits, grouped in threes so they survive being read aloud. The subject line carries them too, so a lock-screen preview is enough.

Browser binding A magic link opened in another browser does not sign that browser in. It confirms the request, and the tab that asked gets the session.

Five attempts The fifth wrong code burns it. A new one can be requested after 30 seconds, and requests are limited per address and per IP.

3.0Social and SSO

Social sign-in for people. SAML and OIDC for their employers.

Social providers are a switch. Enterprise connections are a link you send to your customer's IT admin, who pastes two values and is done. Underneath, both are the handshake below.

Browser
Your app
Latch
IdP
  1. Marta types marta@okapi.health into your sign-in box. There is no “SSO” button to find: the domain decides.

Step 1 of 8

Message 1 · Browser → Your app

Enter work email

Marta types marta@okapi.health into your sign-in box. There is no “SSO” button to find: the domain decides.

Nothing to show on the wire: this step is a person at a keyboard.

Parties in this figure

Browser
Marta's laptop
Your app
app.acme.dev
Latch
auth.acme.dev
IdP
Okta
Fig. 3.1SP-initiated single sign-on for marta@okapi.health. Select a message to read what is on the wire.

3.2Social providers

Three on Free, all of them from Pro. Each uses your own OAuth credentials in production, so the consent screen says your name.

Social sign-in providers, their protocol and default scopes
ProviderProtocolDefault scopesEmail verified by provider
GoogleOIDCopenid email profileYes
GitHubOAuth 2.0read:user user:emailYes, primary address
AppleOIDCname emailYes, may be a relay address
MicrosoftOIDCopenid email profileWork accounts only
GitLabOIDCopenid emailYes
SlackOIDCopenid email profileYes
  • Google

    Protocol
    OIDC
    Default scopes
    openid email profile
    Email verified by provider
    Yes
  • GitHub

    Protocol
    OAuth 2.0
    Default scopes
    read:user user:email
    Email verified by provider
    Yes, primary address
  • Apple

    Protocol
    OIDC
    Default scopes
    name email
    Email verified by provider
    Yes, may be a relay address
  • Microsoft

    Protocol
    OIDC
    Default scopes
    openid email profile
    Email verified by provider
    Work accounts only
  • GitLab

    Protocol
    OIDC
    Default scopes
    openid email
    Email verified by provider
    Yes
  • Slack

    Protocol
    OIDC
    Default scopes
    openid email profile
    Email verified by provider
    Yes

4.0MFA and step-up

A second factor when it matters, not on every click.

Requiring two factors at sign-in is one switch. Step-up is the finer tool: the session stays as it is until the user reaches something sensitive, and only then proves again who they are.

app/billing/actions.ts
"use server";import { requireStepUp } from "@latch/nextjs";export async function changePayout(to: Iban) {  await requireStepUp({    level: "aal2",    maxAge: "10m",  });  // Runs only with a fresh second factor.  await payouts.setAccount(to);}
app.acme.dev/settings/billingAAL1

Billing

Signed in as ada@acme.dev

One factor · email code

No recent second factor

  • Download invoices

    billing:read
    AAL1
  • Add a seat

    billing:seats
    AAL1
  • Change payout account

    billing:payout
    Needs AAL2
  • Rotate API keys

    apikeys:rotate
    Needs AAL2

Nothing is asking for a second factor.

Run one of the two actions marked “Needs AAL2” to trigger the prompt.

Authenticator

Acme · ada@acme.dev

318 204

Request log

  1. No requests yet.
Fig. 4.1A billing page protected by step-up. Run the actions; the sensitive ones ask for the code from the authenticator.

4.2Factors

Second factors, how each is verified and how a user recovers
FactorHow it is checkedCounts asRecovery
PasskeySignature with user verificationTwo factors in oneAnother passkey
Authenticator appTOTP, 30-second window, ±1 stepSecond factorBackup codes
Backup codesTen codes, single use, hashedSecond factorRegenerate in profile
SMS codeOff by default; SIM swaps existSecond factorAdmin reset
  • Passkey

    How it is checked
    Signature with user verification
    Counts as
    Two factors in one
    Recovery
    Another passkey
  • Authenticator app

    How it is checked
    TOTP, 30-second window, ±1 step
    Counts as
    Second factor
    Recovery
    Backup codes
  • Backup codes

    How it is checked
    Ten codes, single use, hashed
    Counts as
    Second factor
    Recovery
    Regenerate in profile
  • SMS code

    How it is checked
    Off by default; SIM swaps exist
    Counts as
    Second factor
    Recovery
    Admin reset

5.0Bots and breaches

Most sign-in attempts are not people.

In October 2026, 13% of the requests that reached a Latch sign-in endpoint came from automation. These are the rated values of the layers that deal with them, on every plan, with nothing to configure.

Latch · Abuse protection

All production tenants, 1–31 Oct 2026

Credential-stuffing attempts refused
61.4MBefore a password was ever compared
Leaked password hashes checked against
1.3BRefreshed weekly from public breach corpora
Humans who saw a challenge
0.4%The other 99.6% never knew it ran
Added to a sign-in, p50
9 msScoring runs in the same edge location

5.1Layers, outermost first

Abuse-protection layers, what each inspects and how it responds
LayerWhat it looks atResponse
Request scoringTLS fingerprint, header order, pointer and timing signalsInvisible proof-of-work, then a challenge
Velocity limitsAttempts per account, per IP and per /24 in sliding windows429 with Retry-After
Breached passwordsSHA-1 prefix of the password against 1.3 billion leaked hashesSign-up refused, or reset forced at sign-in
Disposable email42,000 throwaway domains, updated dailySign-up refused with a plain message
Account lockoutTen failures on one accountLocked for 15 minutes, owner notified
  • Request scoring

    What it looks at
    TLS fingerprint, header order, pointer and timing signals
    Response
    Invisible proof-of-work, then a challenge
  • Velocity limits

    What it looks at
    Attempts per account, per IP and per /24 in sliding windows
    Response
    429 with Retry-After
  • Breached passwords

    What it looks at
    SHA-1 prefix of the password against 1.3 billion leaked hashes
    Response
    Sign-up refused, or reset forced at sign-in
  • Disposable email

    What it looks at
    42,000 throwaway domains, updated daily
    Response
    Sign-up refused with a plain message
  • Account lockout

    What it looks at
    Ten failures on one account
    Response
    Locked for 15 minutes, owner notified

5.2Breached passwords, checked without sending them

If you offer passwords, every new one is compared with the corpus before it is accepted, and every existing one at sign-in. The lookup is built so that neither Latch's corpus service nor anyone on the path learns the password, or even its full hash.

Hash SHA-1 of the password, computed in memory.

Prefix The first five characters go to the corpus. About 800 leaked hashes share any prefix.

Range Every suffix under that prefix comes back, with how often each was seen.

Verdict The match is made locally. The corpus never learns which suffix was yours.

Try

Nothing you type here is sent anywhere. The hash is computed in this tab.

  1. SHA-1, in memory

    5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8
  2. Sent to the corpus

    GET /v1/breach/range/5BAA6
  3. Returned: 792 suffixes

    • BD17AA98BEF8D76DB89A0B6E4253DA5E9EF780
    • 1E4C9B93F3F0682250B6CF8331B7EE68FD89,545,824
    • E729A416F2460D264ED343CA652B55ADFA05,172
    • DF21D80DBC5E061C8B67DF9F4BCC5FA95378,766
    • … 788 more
  4. Compared on the device

    Seen 9,545,824 times in breaches. Refused at sign-up; a reset is forced at sign-in.

Fig. 5.1The breached-password lookup. Only five characters of the hash leave the device; the comparison happens locally.

6.0Comparison

Method by method.

Measured on production sign-ins in October 2026. Offer more than one: the table tells you which to put first.

Sign-in methods compared by phishing resistance, speed, failure rate and recovery
MethodThe user needsRecoveryPlan
PasskeyWebAuthnFullOrigin-boundA device with a screen lock4 s0.9%Second passkey or email codeAll
Social sign-inOIDC, OAuth 2.0PartialAs good as the providerAn account with the provider6 s1.8%The provider'sAll (3 on Free)
Enterprise SSOSAML 2.0, OIDCPartialThe employer's policyA company identity8 s1.2%The customer's IT adminPro, $50 a connection
Passwordargon2id + breach checkNoneCan be typed anywhereMemory9 s7.4%Email resetAll
Magic linkSigned URL, single usePartialBound to the asking browserThe inbox, on any device19 s4.6%Ask againAll
Email code6 digits, 10 minutesWeakCan be relayed liveThe inbox, on any device23 s3.1%Ask againAll
Authenticator appTOTP, second factorWeakCan be relayed liveA phone with the app11 s2.2%Backup codesPro
  • Passkey

    WebAuthn

    FullOrigin-bound
    Time to sign in
    4 s
    Failure rate
    0.9%
    Recovery
    Second passkey or email code
    Plan
    All
  • Social sign-in

    OIDC, OAuth 2.0

    PartialAs good as the provider
    Time to sign in
    6 s
    Failure rate
    1.8%
    Recovery
    The provider's
    Plan
    All (3 on Free)
  • Enterprise SSO

    SAML 2.0, OIDC

    PartialThe employer's policy
    Time to sign in
    8 s
    Failure rate
    1.2%
    Recovery
    The customer's IT admin
    Plan
    Pro, $50 a connection
  • Password

    argon2id + breach check

    NoneCan be typed anywhere
    Time to sign in
    9 s
    Failure rate
    7.4%
    Recovery
    Email reset
    Plan
    All
  • Magic link

    Signed URL, single use

    PartialBound to the asking browser
    Time to sign in
    19 s
    Failure rate
    4.6%
    Recovery
    Ask again
    Plan
    All
  • Email code

    6 digits, 10 minutes

    WeakCan be relayed live
    Time to sign in
    23 s
    Failure rate
    3.1%
    Recovery
    Ask again
    Plan
    All
  • Authenticator app

    TOTP, second factor

    WeakCan be relayed live
    Time to sign in
    11 s
    Failure rate
    2.2%
    Recovery
    Backup codes
    Plan
    Pro

Time is the median from focusing the first field to a session. Failure is the share of attempts abandoned or refused.

7.0Questions

Questions about signing in.

Six that come up in almost every integration review.

Read the guides

No. Passwords are a method like any other and are off in new applications. About a third of production apps on Latch run without them: passkeys first, email codes as the fallback. If you import users with password hashes they keep working, and you can retire the method later without signing anyone out.

8.0Get started

Switch on a method. The rest is already wired.

Every method on this page is a line in one array. Start with passkeys and email codes on the free plan, and add the others the day a customer asks.

npm install @latch/nextjs

Included on Free

Monthly active users
10,000
Passkeys, codes, links
Included
Social providers
3
Organizations
5 members each
Card required
No