Skip to main content

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
}
}
FieldMeaning
channelsms 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_toMasked address to show ("We sent a code to ***0147").
expires_inSeconds the code is valid (600).
new_customertrue 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",
"email": "[email protected]",
"device": "Pixel 8 (Android)"
}
FieldRequiredMeaning
identifieryesThe same value as in step 1
codeyesThe 6 digits
namenew playersFull name for the new account
emailnoEmail of a new player who signed in with a phone number
devicenoShown 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",
"email": "[email protected]",
"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​

{"login": "[email protected]", "password": "Secret-2026", "device": "iPhone 15"}
{
"data": {
"token": "fbk_9oQm1x7Kc2LwTqV4sZr8NbYp3HdE6uFa0JgXiC5tAkM",
"token_type": "Bearer",
"expires_at": "2027-02-17 07:06:47",
"customer": {
"id": 36,
"name": "Omar Khan",
"email": "[email protected]",
"phone": "+1 646 555 0199",
"login": "[email protected]"
}
}
}

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:

  1. POST /auth/code with the email as identifier. 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.
  2. POST /auth/signup with 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.

FieldRequiredRule
nameyes
emailyesBecomes the login. Refused when an account with this email exists.
codeyesThe code sent to email
passwordyesAt least 8 characters
phonenoKept 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 401 with unauthorized means 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",
"email": "[email protected]",
"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:

{"name": "Sara Ahmed", "email": "[email protected]"}

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:

LimitValue
Code valid for10 minutes
Wait before asking again for the same number or email60 seconds
Codes per number or email5 per hour
Codes per network address20 per hour
Wrong tries per code5

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."

Was this page helpful?