Profile
Read the signed-in user's profile and edit the Personal Details form and the profile picture.
All requests go to the gateway and need the authentication headers.
Get User Profile
Query · sso_userProfile
Reads the signed-in user's profile, wallet balances, service discounts,
contacts and recovery options. AuthGate runs it once right after sign-in and
stores the result in Redux; useRefreshProfile re-runs it with
fetchPolicy: "network-only" (for example after a payment changes the
balance).
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
mySabayID | Int | No | Not sent by the app; without it the token's user is returned. |
Variables
{}
Request
query SsoUserProfile {
sso_userProfile {
objectID
userID
givenName
familyName
dateOfBirth
gender
profilePicture
walletStatus
wallet {
balance
assetCode
}
serviceDiscounts {
discountRate
validUntil
serviceCode
}
hasSecurityPassword
gamertag
status
contacts {
email
phoneNumber1
phoneNumber2
phoneVerified
emailVerified
}
recoveryOptions {
name
status
}
}
}
Response
Generated from the schema; values show field types.
{
"data": {
"sso_userProfile": {
"objectID": "String!",
"userID": "Int!",
"givenName": "String!",
"familyName": "String!",
"dateOfBirth": "Int!",
"gender": "String!",
"profilePicture": "String!",
"walletStatus": "Int",
"wallet": [
{ "balance": "Float!", "assetCode": "String!" }
],
"serviceDiscounts": [
{ "discountRate": "Float!", "validUntil": "Int", "serviceCode": "String!" }
],
"hasSecurityPassword": "Boolean!",
"gamertag": "String",
"status": "Int!",
"contacts": {
"email": "String!",
"phoneNumber1": "String!",
"phoneNumber2": "String!",
"phoneVerified": "Int",
"emailVerified": "Int"
},
"recoveryOptions": [
{ "name": "String!", "status": "Boolean!" }
]
}
}
}
The UI treats contacts.phoneVerified / emailVerified equal to 1 as
verified, shows phoneNumber1 (falling back to phoneNumber2), reads the
recovery switch from the recoveryOptions entry with name: "phone", and shows
"Add" or "Change" for the security password from hasSecurityPassword
(security-overview.tsx).
Update User Profile
Mutation · sso_updateUserProfile
Saves the Personal Details form (profile-tab.tsx).
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
input | sso_UpdateFieldProfile! | Yes | The fields to change |
input
All fields are optional in the schema; the UI sends the first five.
| Field | Type | Required | Description |
|---|---|---|---|
givenName | String | No | Required by the form. |
familyName | String | No | |
dateOfBirth | Int | No | Unix timestamp in seconds; the form converts its yyyy-MM-dd date with formatDateToUnix. |
gender | sso_ProfileGender | No | male | female |
gamerTag | String | No | Labelled Company/Organization in the UI and required by the form. |
languagePreference | String | No | Not sent by the UI. |
profilePicture | String | No | Not sent by the UI. |
status | Int | No | Not sent by the UI. |
nationalID | String | No | Not sent by the UI. |
phone | String | No | Not sent by the UI. |
email | String | No | Not sent by the UI. |
secondaryPhone | String | No | Not sent by the UI. |
facebook | String | No | Not sent by the UI. |
SCDisplayCurrency | sso_SCDisplayCurrencyType | No | KHR | SC. Not sent by the UI. |
type | Int | No | Not sent by the UI. |
The input field is gamerTag (capital T), while the profile field returned by
sso_userProfile and this mutation is gamertag.
Variables
{
"input": {
"givenName": "Sokha",
"familyName": "Chan",
"dateOfBirth": 631152000,
"gender": "male",
"gamerTag": "My Company"
}
}
Request
mutation Sso_updateUserProfile($input: sso_UpdateFieldProfile!) {
sso_updateUserProfile(input: $input) {
userID
objectID
givenName
familyName
dateOfBirth
gender
gamertag
}
}
Response
Generated from the schema; values show field types.
{
"data": {
"sso_updateUserProfile": {
"userID": "Int!",
"objectID": "String!",
"givenName": "String!",
"familyName": "String!",
"dateOfBirth": "Int!",
"gender": "String!",
"gamertag": "String"
}
}
}
Update Profile Picture
Mutation · sso_updateUserProfilePicture
Points the profile at an image URL. It is sent to the gateway (the hook sets
no media clientName).
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
profilePicture | String! | Yes | URL of the image. |
How the UI gets the URL (upload-profile-picture-dialog.tsx): the user picks a
PNG, JPEG or WebP (max 5 MB) and crops it (round). The image is first uploaded
to the media service with uploadMedia (serviceCode: cloud_user, title
profile-<userID>) into a folder named profile_picture, which is found with
listFolder or created with createFolder (see Media). The
returned URL is then saved with this mutation. The dialog also accepts an image
URL typed directly, which is saved as is.
Variables
{
"profilePicture": "https://<media-host>/<path>/profile-<userID>.png"
}
Request
mutation uploadProfiePicture($profilePicture: String!) {
sso_updateUserProfilePicture(profilePicture: $profilePicture)
}
Response
Generated from the schema; values show field types.
{
"data": {
"sso_updateUserProfilePicture": "String!"
}
}