Clouzark

Auth

Sign up and sign in your app's users.

Each database has its own user accounts, stored in the auth.users table. These are your app's users, not Clouzark team members.

Base URL: https://api.clouzark.com/auth/<database ref>, called with the anon key in the apikey header.

Sign up and sign in

const base = 'https://api.clouzark.com/auth/my-app-db';
const headers = { apikey: ANON_KEY, 'Content-Type': 'application/json' };

const { user, token } = await fetch(`${base}/signup`, {
  method: 'POST',
  headers,
  body: JSON.stringify({ email, password }),
}).then((r) => r.json());

POST /login takes the same body and returns { user, token }. Send the token as Authorization: Bearer <token> to the REST, GraphQL, Storage, and Realtime APIs to act as that user; auth.uid() then returns their id in row-level security policies.

Endpoints

RequestDoes
POST /signup { email, password }Create a user and sign them in
POST /login { email, password }Sign in
POST /logoutSign out
GET /meThe signed-in user
PUT /user { password }Change the signed-in user's password
POST /magiclinkEmail a sign-in link
POST /recoverEmail a password reset link
GET /factors, POST /factors, POST /factors/<id>/verify, DELETE /factors/<id>Multi-factor authentication

Email templates, providers, and rate limits are set in the dashboard under the database's Authentication settings.

On this page