User data

Every app receives the same user object from /oauth/token and /oauth/userinfo. This page explains what’s in it and how to link accounts correctly.

Fields

{
  "sentra_id": "8f3a1c52-7d0e-4b6a-9c21-5e7f0a3d9b14",
  "name": "Aisyah Rahmawati",
  "picture": "https://api.sso.sentratechnology.com/files/8f3a1c52.jpg",
  "credential": "aisyah.rahmawati@contoh.id",
  "roles": ["editor"],
  "user_types": ["umum"]
}
FieldTypeContent
sentra_idstring (UUID)The user’s permanent ID in Sentra. It never changes.
namestringFull name. The user can change it.
picturestring or nullProfile photo URL, or null when there’s none.
credentialstringThe account’s email, or its username when it has no email.
rolesstring[]The user’s roles in your app. May be empty.
user_typesstring[]User types, such as umum. May be empty.

The data is read when the code is exchanged, so you get fresh data every time the user signs in. Update name and picture in your app at that moment.

sentra_id

Use sentra_id as the user key in your app. It stays the same when the user changes their name, email or username. Accounts in Sentra are never deleted, only deactivated, so a sentra_id is never reused by someone else.

credential

credential holds the account’s sign-in identifier: the email when the account has one, otherwise the username. Accounts created by an admin or through an import may have no email.

Use credential for display only. Don’t assume it’s always an email address, and never link accounts on it. Emails in Sentra aren’t verified, and credential can change when the user adds or changes an email.

roles

roles holds the role keys from your app’s Peran aplikasi (app roles) catalog in the console that a Sentra admin gave this user. It contains:

  • Only roles for your app, never roles in other apps.
  • Only keys, such as editor, not display names.
  • Information, not permissions. Your app decides what each role may do.

A user without roles gets roles: [].

user_types

user_types holds the user types a Sentra admin manages for the whole service, such as umum. Like roles, it’s only information.

What isn’t sent

  • Phone number.
  • The user’s role in Sentra itself (such as developer or admin).
  • The user’s roles in other apps.
  • Passwords, in any form.

Identifier formats

Users can sign in to Sentra with an email, a phone number or a username. The formats can’t collide:

IdentifierFormat
EmailAlways contains @. Required for self sign-up, optional for accounts made by an admin or an import.
PhoneStored in international format with +, such as +6281234567890. Input like 0812… becomes +62812….
Username3–64 characters: lowercase letters, digits, dot, underscore or hyphen. Never contains @ or +.

All-digit usernames can only be created by a Sentra admin or an import. Usernames people pick when they sign up themselves always contain a letter.

Lookup order at sign-in

Sentra finds the account from what the user typed in this order:

  1. Contains @: looked up as an email.
  2. Starts with +: looked up as a phone number.
  3. Anything else: looked up as a username. If there’s no match and the input starts with 0 like a local phone number, Sentra looks it up as a phone number.

When one input could match two accounts, the username wins. For example, if an account has the username 081234567890, typing 081234567890 opens that account, not the one with the phone number +6281234567890.

Linking accounts

  1. Store sentra_id on the local user (a unique, nullable column) and look users up only by it.
  2. If no local user has that sentra_id, create a new user or show "account not registered", following your app’s policy. Never link automatically on email, username or credential.
  3. To link existing users before their first sign-in, store the sentra_id column from an import result. See User import.
  4. Merge duplicate accounts with an admin tool in your own app.

Code examples are in the Laravel and Next.js tutorials.