Skip to main content

11.3 Authentication (Better Auth)

ANY /api/v1/auth/{operation}​

  • Purpose. Catch-all for Better Auth. Methods exported: GET, POST, PATCH, PUT, DELETE.
  • Response format. Better Auth's own JSON. Not wrapped in the DFFMS envelope. The exact body of each operation is not specified in this codebase.

Endpoints enabled by the configuration (paths confirmed from the installed Better Auth 1.7.6 package):

Method and pathPurposeNotes
POST /sign-up/emailRegister a public accountRate limit 5 per minute. Sends verification email.
POST /sign-in/emailSign in with email and passwordRate limit 10 per minute. Verified email required.
POST /sign-outEnd the session
GET /get-sessionRead the current session
POST /request-password-resetStart password resetRate limit 3 per 5 minutes. Resets revoke other sessions.
POST /reset-passwordComplete password reset
POST /verify-email and /send-verification-emailEmail verificationToken expires in 30 minutes.
GET /sign-in/social, GET /callback/:idGoogle sign-inOnly when Google is configured.
POST /two-factor/enable, /disable, /generate-backup-codes, /get-totp-uri, /send-otp, /verify-otp, /verify-totp, /verify-backup-codeTwo-factor management and challengeRate limit 10 per minute. Account locks for 15 minutes after 5 failed attempts.
POST /passkey/generate-register-options, /passkey/verify-registration, /passkey/generate-authenticate-options, /passkey/verify-authentication, /passkey/authenticate, /passkey/register, GET /passkey/list-user-passkeys, POST /passkey/update-passkey, /passkey/delete-passkeyPasskey managementRP ID is the app host.

Example (sign-in):

curl -s -X POST https://dffms.org/api/v1/auth/sign-in/email \
-H 'Content-Type: application/json' \
-H 'Origin: https://dffms.org' \
-d '{"email":"ada@demo.dffms.org","password":"<password>"}' \
-c cookies.txt
  • Side effects.
    • Account-security notices (in-app, email and push) are sent when sign-in protection changes.
    • Session creation records the last successful sign-in.
  • Account types. accessType is PUBLIC_USER or STAFF_USER; status is ACTIVE, SUSPENDED, CLOSED or ARCHIVED. Users cannot set these fields through sign-up.