Launch offer for the first 500 accounts: $10K MTR free for 24 months + $100 credit →
    .io

    Passwords

    Passwords are optional

    A user can exist without one and sign in by code or passkey instead. Where you do use passwords, BillDog stores them with Argon2id and a server-side pepper, and enforces a policy you configure per project.

    Signing in

    Code
    const result = await auth.attempt({
      identifier: 'ada@example.com',
      strategy: 'password',
      password,
    });
    
    if (result.mfaRequired) { /* see Multi-factor */ }
    else { use(result.session); }

    Wrong password, unknown user, banned account, locked account and expired code all return the same 401 with the same message. Ten consecutive failures lock the account for fifteen minutes; the lock is also invisible in the response, for the same reason.

    The policy

    Configured in Project Settings → Auth, enforced server-side on sign-up, on reset and on change — and before anything is written, so a refused password leaves nothing behind.

    RuleDefaultNotes
    Minimum length8NIST 800-63B's floor
    Maximum length72bcrypt's byte cap. Argon2id has no such limit; the number is kept so a password that works elsewhere works here
    Lower / upper / number / symbolAll offComposition rules push people toward Password1!. Length and the breach check correlate better with real takeover
    Reject breachedOnOn sign-up, reset and change
    Reject breached on sign-inOnThe one rule that can fire at sign-in — see below

    A rejected password comes back naming the requirement it missed. The request schema deliberately does not enforce length — otherwise a project with a twelve-character minimum would answer "Request validation failed" and leave the person retyping with nothing to go on.

    The breach check

    A match means this password appeared in a public breach corpus — not that your user's account was breached. The message says so, because the alternative alarms people about the wrong thing.

    Sign-in is the only place a policy can fire retroactively. A stored password is a hash, so length and composition cannot be re-evaluated later — but at sign-in the plaintext is momentarily present, which catches a password that was fine when chosen and has since appeared in a breach. Leave it on unless you have a reason.

    How they are stored

    • Argon2id, run in the edge runtime rather than in Postgres.
    • A server-side pepper held outside the database, so a database dump alone cannot be attacked offline.
    • Each hash records the pepper version that produced it, so rotating the pepper is a rolling rehash on next sign-in rather than a mass lockout.
    • Credentials are US-resident. A project in another data region cannot enable auth at all — refusing is honest; storing hashes in the wrong jurisdiction is not.

    Resetting a password

    Two calls: request a reset code, then present it with the new password. The code is the proof, so the reset needs no session and issues none — the person signs in afterwards with the new password. Completing a reset signs every device out: the usual reason to reset is that somebody else has the account, and a reset that left their session alive would achieve nothing. If the device doing the reset held a session for that user, its next refresh is refused and the SDK signs out locally.

    await auth.requestPasswordReset({ identifier: 'ada@example.com' });
    // -> { sent: true } whether or not the address is registered
    
    // They read the emailed code, then:
    const { sessionsRevoked } = await auth.resetPassword({
      identifier: 'ada@example.com',
      code: '123456',
      newPassword: 'a-new-long-passphrase',
    });
    // No session is issued. Sign in with the new password.

    Pass the same kind to both calls — a phone reset that leaves it at email in either place silently matches nothing. A wrong or expired code is the same opaque 401 as every other refusal, and each wrong guess burns one of the code's attempts; the new password is checked against the policy before anything is written. On a hosted wall the Auth Card runs this whole flow behind its "Forgot your password?" link.

    A reset code cannot sign anyone in. The purposes are enforced separately: a code minted for reset_password is refused by attempt, and a sign-in code is refused here. If either were accepted, "forgot password" would be a complete authentication bypass for anyone who can request one for an address.

    Changing a password

    From a signed-in device, proving the current password. A live session alone is deliberately not enough: a stolen, unlocked phone would otherwise let its holder change the password and lock the owner out. A change keeps this session and revokes every other one, so the person stays signed in where they are and is signed out everywhere else.

    const { sessionsRevoked } = await auth.changePassword({
      currentPassword,
      newPassword,
    });
    // Still signed in here; authHeaders() is unchanged.
    // Throws 'not_signed_in' before any request when there is no session to change.

    A refused current password is a plain 401 and changes nothing locally — a typo must not sign anyone out. On hosted sign-in the built-in account portal at /account has the control; the Worker supplies the refresh cookie to that call, so the page never holds the token.

    Next

    Was this page helpful?

    Or rate this page:

    We use cookies and process your data to provide our services. By continuing, you agree to our Terms and Privacy Policy.