Sign-up
signUp adds POST /auth/sign-up: an account with an email address and a password. It needs messages and links, and the users and tokens stores.
- The password is checked against the password policy:
400 WEAK_PASSWORDwithdata.rule. users.create({ email, passwordHash, emailVerified: false, method: 'password', extra }, meta)creates the account, inside the transaction of the step.extraholds the fields ofsignUp.schema, validated with the body.- With
emailVerification, a verification link is sent (email_verification).codeChallenge(PKCE, S256) binds it to the browser that signs up: opened without itscodeVerifiernor the password of the account, the link verifies the address but removes the password, which may be someone else's (see Binding the link to the browser). - The
user.signed_upevent is recorded.
The address is trimmed and lowercased before it reaches the data provider.
Existing addresses
Without autoLogin, the address of an existing account gets the same answer, 202, in a comparable time: nothing is written, and its owner receives a sign_up_existing_account message instead, with a password reset link when passwordReset is on. The answer does not tell which addresses have an account.
An address of a domain that logs in with its IdP (SSO enforcement) answers 403 SSO_REQUIRED, with data.connectionId.
Starting a session
signUp.autoLogin starts a session at sign-up: the answer is the one of a login, 200 { status: 'authenticated', userId, accessToken, … }, with mode: 'cookie' too. It defaults to true without emailVerification, and to false with it; createAuth() refuses it with emailVerification.required.
With autoLogin, a new address gets 200 and a session, an existing one 202: the answer tells whether an address has an account. Leave it off when the list of your users must stay private.
With emailVerification, the session starts once the email is verified: see emailVerification.autoLogin in Email verification. The verification revokes the sessions opened before it. What a session of an unverified account adds (passkeys, linked accounts, second factors) does not outlive the claim of the account by the owner of its address: it is removed with the password (see Magic link).
Invitations and consents
users.create() runs in the transaction of the step: consume an invitation, record the accepted terms, create a workspace there. Throw signUpRejected(reason) to reject the sign-up: the route answers 400 SIGN_UP_REJECTED with data.reason, and the transaction is rolled back.
users.create() throws when another account uses the address, whatever its case: put a unique, case-insensitive constraint on the column.
mode: 'invite_only' documents that the sign-up needs an invitation, a field of schema; checking it is the job of users.create(). mode: 'closed' answers 403 SIGN_UP_DISABLED, and closes the sign-up by magic link and by social login too.
Cookie mode
With mode: 'cookie', a request from an untrusted origin answers 403 CROSS_ORIGIN_REQUEST: another site cannot open a session of its own in the browser of the user. See CSRF.
Rate limits
5 sign-ups per hour per IP address (rateLimits.signUp.ip), and 3 per hour per address (rateLimits.signUp.email), then 429 TOO_MANY_REQUESTS with Retry-After.
Service
auth.signUp.register({ email, password, extra?, redirectTo?, codeChallenge?, meta?, locale? }) does the same outside the routes: an import script, an admin console. It returns { status: 'verification_sent' | 'accepted' }, or { status: 'authenticated', userId, tokens }.