Rezin Core Rezin Core
Docs

Authentication

Sign in by phone

Your application's people sign in with a code sent to their phone by text message. No password.

The message goes out through your own account with an SMS provider. You paste that account's details into the console and Rezin Core calls the provider for you. Rezin Core has no SMS account of its own: the provider bills you for the messages, at its prices.

Today the provider is Twilio.

Setting it up

Sign-in, Providers, Phone.

SettingWhat it is
Account IDYour Twilio account's ID. It starts with AC.
Auth tokenThe account's token. It is sealed in the project's Secrets as TWILIO_AUTH_TOKEN and never shown again.
Send fromA Twilio messaging service (MG…), or one of your Twilio phone numbers in international form.
A code lasts30 to 600 seconds. 60 unless you change it.
Digits in a code4 to 8. 6 unless you change it.
The messageOne line, up to 140 characters, containing {code} exactly once.
Content IDFor WhatsApp only: your approved template (HX…).

Send a test message sends the message with a code of zeros to a number you type, through your account. If the provider refuses, its own reason is shown to you.

Tick Let people sign in with their phone number and save. It cannot be switched on before the account ID, the sender and the token are in.

What is sent, and where

For each code, Rezin Core sends your SMS provider two things: the phone number, and the message. The only thing that varies in the message is the code; nothing else about the person is ever put in it. The request goes to the provider's own address and nowhere else.

That is the one place a phone number leaves Rezin Core, and it goes to the provider you chose.

Signing in

Ask for a code:

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

{ "phone": "+14155550123" }

The answer is always 202 { "sent": true }. A code is sent when the number has an account, or when the project lets people make their own account. The answer does not say which.

Numbers are written in international form: a plus sign, the country code, the number. Spaces, brackets and dashes are ignored.

Sign in with it:

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

{ "phone": "+14155550123", "code": "482913" }

Answer, the same shape as any sign-in, plus whether the account is new:

{ "token": "…", "userId": "…", "organizationId": "…", "mustChangePassword": false, "idleMinutes": 15, "created": true }
  • A number with no account gets one, in the organization new accounts join, if the project lets people make their own. Otherwise the code is refused.
  • An account with an authenticator app is asked for that code too: 401 code_required. Send the same texted code again with secondStepCode.

Errors: 401 bad_code (wrong, expired or already used), 400 bad_phone, 403 method_off, 429 too_many_requests.

Adding a number to an account that is signed in

POST /v1/auth/phone/add              { "phone": "+14155550123" }
POST /v1/auth/phone/add/verify       { "phone": "+14155550123", "code": "482913" }

Both take the account's token. The number becomes the account's only once the code proves the person holds it. It replaces any number the account had. A number that already belongs to another account gets no code, and the answer does not say so.

An account has one number. A number belongs to one account in a project; the same number can be used in another project.

Limits that protect your bill and other people's phones

  • One code a minute and five an hour for a number, whoever asks. Asking again sooner answers the same and sends nothing.
  • Five wrong tries and a code is dead. Ask for a new one.
  • A code works once and for as long as you set.
  • Asking for a code counts toward the sign-in limit for the caller's network address.

How it is kept

Codes are kept only as keyed hashes. The record shows that a code was asked for and that someone signed in by phone; it never holds the code or the number. In the console, Sign-in, Accounts shows which accounts sign in by phone and finds an account by its number.

An account made by its phone number has no email address and no password. It can add an email later with change of email.

Not built

  • SMS providers other than Twilio.
  • Requiring a confirmed phone number before another kind of sign-in.
  • A real text message has not been sent through this from Rezin Core's own testing: the tests use a stand-in for the provider. Use Send a test message when you set it up.

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