Rezin Core Rezin Core Docs Sign in

Authentication

Accounts for your users

Rezin Core keeps the accounts of the people who use your application: it stores their passwords as one-way hashes, signs them in, and hands your application a token that identifies them on every request.

These are your application's users. They are separate from console accounts; see Concepts.

All routes are under https://api.rezincore.com/v1/auth and carry your project key in apikey.

Sign up

Self sign-up is off until you switch it on under Authentication → Sign-in methods. New accounts join the organization the project names.

POST /v1/auth/signup
curl -s $API/v1/auth/signup -H "apikey: $KEY" -H "content-type: application/json" \
  -d '{"email":"[email protected]","password":"a long passphrase here","fullName":"Sam Rivera"}'
FieldRequiredNotes
emailyes
passwordyes12 to 200 characters
fullNamenoDefaults to the part of the email before the @
redirectTonoOnly used when the project confirms email addresses; must be on the project's list

Answers:

  • 201 { "id": "<user id>" }: the account exists and can sign in.
  • 202 { "confirmationRequired": true }: the project confirms new addresses by email. Nothing is created until the emailed link is used. See Email flows. The answer is the same whether or not the address already has an account.

If the project has a Site URL, a welcome email is sent in the project's own name.

StatusCodeWhen
400bad_requestNot an email address
400weak_passwordShorter than 12 characters, or longer than 200
403signup_closedThe project does not let people create their own accounts
403method_offThe project has email and password sign-in switched off
409email_in_useThat email already has an account

Sign in

POST /v1/auth/signin
curl -s $API/v1/auth/signin -H "apikey: $KEY" -H "content-type: application/json" \
  -d '{"email":"[email protected]","password":"a long passphrase here"}'
{
  "token": "…",
  "userId": "5b0c1d8e-3f7a-4c2b-9e1d-6a7b8c9d0e1f",
  "organizationId": "0d9c8b7a-6f5e-4d3c-8b2a-1f0e9d8c7b6a",
  "mustChangePassword": false,
  "idleMinutes": 15
}

Send the token on every later request as Authorization: Bearer <token>.

StatusCodeWhen
401bad_loginWrong email or password, a disabled or locked account, or an account of another project. The answer never says which.
401code_requiredThe password was right and the account uses an authenticator app. Send the same request again with "code": "123456". See Authenticator app.
403method_offThe project has email and password sign-in switched off
429too_many_requestsToo many sign-in attempts from this network address

An account signs in only through its own project's keys.

After 5 wrong passwords or codes in a row the account is locked for 15 minutes.

The signed-in user

GET /v1/auth/user
curl -s $API/v1/auth/user -H "apikey: $KEY" -H "authorization: Bearer $TOKEN"
{
  "id": "5b0c1d8e-3f7a-4c2b-9e1d-6a7b8c9d0e1f",
  "email": "[email protected]",
  "fullName": "Sam Rivera",
  "organization": { "id": "0d9c8b7a-6f5e-4d3c-8b2a-1f0e9d8c7b6a", "name": "Example Co" },
  "mustChangePassword": false
}

Sign out

POST /v1/auth/signout
curl -s -X POST $API/v1/auth/signout -H "apikey: $KEY" -H "authorization: Bearer $TOKEN"
{ "ok": true }

Tokens and sessions

A token stops working:

  • after 15 minutes without use (idleMinutes in the sign-in answer tells you the project's own figure);
  • 12 hours after sign-in, whatever happens;
  • on sign-out;
  • when the account is disabled.

A project can make the first two shorter, never longer. See Authentication settings.

There is no refresh token. Using the token keeps it alive up to the 12-hour limit; after that the person signs in again. When a token has ended, requests answer 401 signed_out.

Keep the token in memory or in storage your platform protects. Anyone holding it acts as that user until it ends.

Changing and resetting a password

Change it, signed in. This works for an account that still holds a one-time password, which is how such an account chooses its own.

POST /v1/auth/password
apikey: <publishable key>
Authorization: Bearer <the account's token>

{ "currentPassword": "…", "newPassword": "…" }

Answer: { "ok": true }. The sign-in that asked goes on; every other sign-in of the account ends. The person is sent a short notice by email. Errors: 401 bad_password, 400 weak_password, 401 signed_out.

Forgotten. Ask for a link by email:

POST /v1/auth/recover
apikey: <publishable key>

{ "email": "[email protected]", "redirectTo": "https://app.example.com/new-password" }

The answer is always 202 { "sent": true }, whether or not the address has an account. The emailed link leads to your application (the Site URL, or redirectTo if it is one of the project's listed addresses) carrying rezin_type=recovery and rezin_token. Your page asks for the new password and sends both back:

POST /v1/auth/verify
apikey: <publishable key>

{ "type": "recovery", "token": "<rezin_token>", "password": "…" }

Answer: { "ok": true, "email": "[email protected]" }. The link works once and lasts 30 minutes; a password that is refused as too weak does not use it up. Every sign-in of the account ends, and the person signs in with the new password. It does not remove an authenticator step.

Errors on recover: 403 method_off, 400 bad_redirect, 400 site_url_needed, 503 email_not_ready. On verify: 401 bad_code, 400 weak_password.

Other ways to sign in

Managing accounts in the console

Sign-in, then Accounts.

The list shows each person with their organization, how they sign in, their state, whether they use an authenticator app, when they last signed in and when the account was made. Find one by name, email or ID; sort by a column's heading; it comes fifty at a time.

Add account makes one in the organization you pick, in one of two ways:

  • Email an invitation. The person gets a link to your application carrying rezin_type=invite and rezin_token. Your page asks them for a password and sends { "type": "invite", "token": "…", "password": "…" } to POST /v1/auth/verify. The link lasts 72 hours and works once. Needs a Site URL and email set up for the project.
  • Show me a one-time password. It is shown once, to you, to pass on yourself. The account must choose its own at first sign-in (POST /v1/auth/password, above).

Open an account to see where it is signed in now, how it signs in, and what has happened to it according to the project's record. From there you can:

  • send a password reset, or a sign-in link when the project uses them;
  • sign it out everywhere, or end one sign-in;
  • reset its authenticator, for someone who has lost their phone and their recovery codes: the step is taken off, every sign-in of theirs ends, and they set it up again;
  • disable it (signed out at once, cannot sign in until enabled) and enable it again;
  • delete it, after typing its email address. An account that rows or files still belong to cannot be deleted; disable it instead.

Each of these is written on that account's own organization's record. A read-only member of the company can look and change nothing.

What is not built

Said plainly, so you can plan around it:

  • A refresh token, anonymous sign-in, phone sign-in and passkeys. See More sign-in methods.
  • An email address belongs to one account on Rezin Core, so the same address cannot have accounts in two projects.

This page as Markdown · llms.txt · Rezin Core is in development and available by invitation.