Sign-in and tokens
Players sign in with a one-time code sent to their mobile number or email, with an email and password, or both: the venue chooses in Odoo. Read sign_in from GET /config and show only the methods that are on:
"sign_in": {"code": true, "password": true}
Every successful sign-in returns a token for this device. Send it on every call that needs a player:
Authorization: Bearer fbk_9oQm1x7Kc2LwTqV4sZr8NbYp3HdE6uFa0JgXiC5tAkM
Only player accounts can sign in. Staff accounts (users of the Odoo back office) are refused, so a cashier cannot use the player app with their Odoo login.
Sign in with a code
1. Ask for a code: POST /auth/code
identifier is what the player typed: a mobile number in any common format ((646) 555-0147, +1 646 555 0147, 0300 1234567). Numbers without a country code use the country of the venue or an email address.
{"identifier": "(646) 555-0147"}
{
"data": {
"channel": "sms",
"sent_to": "***0147",
"expires_in": 600,
"new_customer": true
}
}
| Field | Meaning |
|---|---|
channel | sms or email: where the code went. With "SMS, email when SMS fails", a failed SMS goes to the player's email if Odoo knows it. |
sent_to | Masked address to show ("We sent a code to ***0147"). |
expires_in | Seconds the code is valid (600). |
new_customer | true when no account exists yet for this number or email. Ask for the player's name on the code screen. |
The code has 6 digits. A new code for the same number can be asked for after 60 seconds; show a countdown on the "Send again" button.
2. Verify it: POST /auth/verify
{
"identifier": "(646) 555-0147",
"code": "482913",
"name": "Sara Ahmed",
"device": "Pixel 8 (Android)"
}
| Field | Required | Meaning |
|---|---|---|
identifier | yes | The same value as in step 1 |
code | yes | The 6 digits |
name | new players | Full name for the new account |
email | no | Email of a new player who signed in with a phone number |
device | no | Shown to the venue under App Sign-ins, for example Pixel 8 (Android) |
{
"data": {
"token": "fbk_9oQm1x7Kc2LwTqV4sZr8NbYp3HdE6uFa0JgXiC5tAkM",
"token_type": "Bearer",
"expires_at": "2027-02-17 07:06:47",
"customer": {
"id": 35,
"name": "Sara Ahmed",
"phone": "(646) 555-0147",
"login": "+16465550147"
}
}
}
When the number or email is new and no name was sent, the answer is 422 with code name_required. Ask for the name and send the same request again with name; the code stays valid:
{
"error": {
"code": "name_required",
"message": "Tell us your name to create your account."
}
}
A wrong code answers 422 with invalid_code. After 5 wrong tries the code is blocked and the player must ask for a new one.
Sign in with a password
POST /auth/login
{
"data": {
"token": "fbk_9oQm1x7Kc2LwTqV4sZr8NbYp3HdE6uFa0JgXiC5tAkM",
"token_type": "Bearer",
"expires_at": "2027-02-17 07:06:47",
"customer": {
"id": 36,
"name": "Omar Khan",
"phone": "+1 646 555 0199",
}
}
}
A wrong email or password answers 401 with invalid_login. When the venue turned passwords off, the answer is 403 with method_disabled.
POST /auth/signup
Creates a player account with a password and signs it in. The email must be proven first, so sign-up has two steps:
POST /auth/codewith the email asidentifier. A code goes to that address. This works even when the venue turned code sign-in off: the code then only serves the sign-up.POST /auth/signupwith the code:
{"name": "Omar Khan", "email": "[email protected]", "phone": "+1 646 555 0199", "password": "Secret-2026", "code": "573108", "device": "iPhone 15"}
The answer is 201 with the same token object as a login. A wrong or expired code answers 422 with invalid_code; the same limits as for sign-in codes apply.
| Field | Required | Rule |
|---|---|---|
name | yes | |
email | yes | Becomes the login. Refused when an account with this email exists. |
code | yes | The code sent to email |
password | yes | At least 8 characters |
phone | no | Kept on the player's contact card for the venue. It is not proven, so it is not used to sign in and never links the account to an existing customer. |
How accounts are matched
A player only ever gets into an account through something they proved:
- A code proves the mobile number or email it was sent to. That number or email is the account's login.
- When the venue already knows the player (a customer created at the counter) and the proven number or email matches that customer, the new account is linked to them, so the player sees their bookings from the counter too.
- Numbers and emails typed on a profile or at password sign-up are never used to find an account. Nobody can reach another player's bookings by typing their number.
- A player sees and manages their own bookings only, not those of colleagues under the same company.
Tokens
- A token starts with
fbk_. Store it in the Android Keystore or the iOS Keychain, never in plain preferences. - One token per device. A player signed in on a phone and a tablet has two.
- A token is valid for 90 days from its last use. An app that is used keeps working; one that sat unused for three months asks for sign-in again.
expires_at(UTC) is the current end. - Any call answering
401withunauthorizedmeans the token is no longer valid (expired, signed out, or revoked by the venue). Delete it and show the sign-in screen. - The venue sees every signed-in device in Court Booking > Configuration > App Sign-ins and can sign one out there.
- Odoo stores only a hash of the token, so a lost token cannot be shown again: sign in again.
POST /auth/logout
Signs this device out. Send it with the token and an empty body {}.
{
"data": {
"signed_out": true
}
}
The player: GET /me and PATCH /me
{
"data": {
"id": 35,
"name": "Sara Ahmed",
"phone": "(646) 555-0147",
"login": "+16465550147"
}
}
PATCH /me changes any of name, phone and email on the player's contact card and returns the player. Send only what changed:
login (the email or number the account signs in with) does not change: the new phone or email is for the venue's records and messages, not for signing in.
Limits on codes
To protect players and the venue's SMS credits:
| Limit | Value |
|---|---|
| Code valid for | 10 minutes |
| Wait before asking again for the same number or email | 60 seconds |
| Codes per number or email | 5 per hour |
| Codes per network address | 20 per hour |
| Wrong tries per code | 5 |
A refused request answers 422 with a message to show, for example "A code was just sent. Wait a minute before asking for another one."