Skip to content

E-mail and passwords

Sign-up with or without a password, e-mail confirmation, sign-in, recovery, magic links and codes, and changing e-mail or password safely.

Applies to EngineCloud
View as Markdown
On this page
  1. Sign-up
  2. Confirmation links and codes
  3. Sign-in
  4. Forgotten password
  5. Changing password or e-mail
  6. Password policy

Sign-up

Two ways, both with POST /auth/v1/signup:

You sendWhat happens
E-mail and password{ email, password }The user exists, unconfirmed. The e-mail asks to confirm.
E-mail first{ email }The e-mail asks to confirm and create a password. The link opens your «create your password» screen with a session ready to set it.
TypeScript
await sypnia.auth.signUp({ email: 'ana@example.com', options: { data: { name: 'Ana' }, emailRedirectTo: 'https://myapp.com/welcome' } });

options.data goes to user_metadata. emailRedirectTo must match one of the project’s redirect URLs: exact addresses or patterns such as https://*.myapp.com/**.

Confirmation is required by default (require_email_confirmation). Turn it off only for internal tools: an unconfirmed address can belong to someone else.

Every auth e-mail carries a link and a 6-digit code, so a person can confirm on another device by typing the code.

  • Links and codes work once, for one hour (configurable from 5 minutes to 24 hours), and are stored only as hashes.
  • A code allows 5 attempts; then a new e-mail is needed.
  • GET /auth/v1/verify?token_hash=…&type=signup&redirect_to=… confirms and redirects to your app with the session in the address fragment (#access_token=…&refresh_token=…). @sypnia/data reads it and clears it from the address bar.

Sign-in

TypeScript
await sypnia.auth.signInWithPassword({ email, password });   // POST /auth/v1/token?grant_type=password
await sypnia.auth.signInWithOtp({ email });                  // POST /auth/v1/otp: link + code, no password
await sypnia.auth.verifyOtp({ email, token: '483920', type: 'email' });

A wrong password and an unknown e-mail get the same answer, invalid_credentials, so nobody can test which e-mails have accounts.

Forgotten password

resetPasswordForEmail(email, { redirectTo }) always answers 200. If the account exists, the e-mail carries a recovery link; it signs the person in with a short recovery session whose only use is updateUser({ password }).

Changing password or e-mail

  • Password: allowed if the person signed in less than 10 minutes ago; otherwise call reauthenticate() (a code by e-mail) and pass it as nonce. Every other session of the user is ended, and a «your password changed» e-mail goes out.
  • E-mail: a confirmation goes to both the old and the new address; the change applies when both are confirmed. A user without an e-mail confirms only the new one.

Password policy

SettingDefault
Minimum length10 (8 to 128)
Required charactersnone; optional lower, upper, digit, symbol
Breached-password checkon: the first 5 characters of the SHA-1 hash are checked against Have I Been Pwned (k-anonymity: the password never leaves the engine)

Passwords are hashed with argon2id (19 MiB memory, 2 iterations).

  1. Sign-up
  2. Confirmation links and codes
  3. Sign-in
  4. Forgotten password
  5. Changing password or e-mail
  6. Password policy

    Search pages, sections and terms