Authentication

Authentication overview

CubiBase Auth runs on your project host under /auth/v1. Users live in your project’s database, and the access token they receive is the JWT your Data API calls use.

How it fits together

  1. Your app

    email + password

  2. CubiBase Auth

    Argon2id hash

  3. Your database

    example_project_db

Illustration. Sign-up returns the JWT your Data API calls use.
  • Users are rows in auth.users inside your project’s PostgreSQL database — not a shared directory.
  • Passwords are stored only as Argon2id hashes; refresh tokens are stored as hashes too.
  • The accessToken is an HS256 JWT whose sub is the user id. Send it as the bearer token on Data API calls.
  • A table with a user column filters rows by that id automatically.

Sign-in methods

Already have an identity provider? Configure the project to verify its RS256 tokens instead — see External identity providers.

The endpoints at a glance

EndpointPurposeBearer token?
POST /auth/v1/signupCreate a user, return a sessionNo
POST /auth/v1/signup/anonymousCreate an anonymous sessionNo
POST /auth/v1/token?grant_type=passwordSign inNo
POST /auth/v1/token?grant_type=refresh_tokenRefresh a sessionNo
POST /auth/v1/token?grant_type=mfaComplete an MFA challengeNo
POST /auth/v1/token?grant_type=id_tokenVerify a Google ID tokenOptional (links)
GET /auth/v1/authorize?provider=googleStart the Google flowOptional (links)
GET /auth/v1/callbackGoogle redirects back hereNo
POST /auth/v1/logoutRevoke a sessionNo
GET /auth/v1/userRead the signed-in userYes
PATCH /auth/v1/userUpdate the user; convert anonymousYes
POST /auth/v1/factorsEnroll a TOTP factorYes
POST /auth/v1/factors/verifyConfirm the first codeYes
DELETE /auth/v1/factors/{factorId}Remove a factorYes

Project settings

All of this is configured per project in Console → Auth: providers, password rules, token lifetimes, MFA, rate limits, the user directory, and sessions.

SettingDefault
Signup enabledOn
Password sign-in enabledOn
Minimum password length8 characters
Email autoconfirmOn (no confirmation email is sent yet)
Access token lifetime1 hour
Refresh token lifetime30 days
Anonymous sign-insOff
Google sign-inOff
MFAOff (optional or required when on)
Signup rate limit30 per hour per IP
Sign-in rate limit30 per minute per IP

Additional resources