Verification

Add or change the account's email and phone number and confirm each with a one-time code. The phone code can be delivered by SMS or by a messenger bot listed with mysabay_chatbot_listChatBotByUser.

All requests go to the gateway and need the authentication headers.

Email flow

As the UI implements it (verify-email-dialog.tsx, email-step.tsx, otp-step.tsx):

  1. The user enters an email. If the current email is already verified, the same address is rejected client-side ("This is already your email"); an unverified address may be resubmitted to get it verified.
  2. sso_updateProfileEmail(email) sends a one-time code to that address. A truthy result moves the dialog to the code step.
  3. The user types the 6-digit code; on the 6th digit the UI calls sso_verifyProfileEmail(verificationCode) with the code converted to a number (Int!). On success the dialog closes and the profile is re-read.
  4. "Resend code" calls sso_updateProfileEmail again with the same email; it is enabled after a 10-second countdown. No captcha is used for email.

Phone flow

As the UI implements it (verify-phone-dialog.tsx, phone-step.tsx, otp-step.tsx, security-overview.tsx):

  1. The phone step shows a phone field and a Provider select. The options are SMS (always offered first, added by the UI) plus the messengers returned by mysabay_chatbot_listChatBotByUser (upper-cased provider, e.g. TELEGRAM). For Telegram the UI shows steps: start a chat with the bot (link from metadata.bot_url, name from botName), share your phone number in the chat, receive the OTP in Telegram, enter it.
  2. The provider must be a sso_PhoneVerificationProvider value (SMS, TELEGRAM, MAIL, WHATSAPP, LINE); otherwise the UI refuses to send.
  3. On submit the UI runs an invisible Google reCAPTCHA (executeAsync(), site key Constants.reCaptchaKey / RUNTIME_RECAPTCHA_KEY) and sends the phone as digits without the leading +:
  4. A truthy result moves to the code step. On the 6th digit the UI calls sso_verifyProfilePhone(verificationCode) with the code as a string (keeps leading zeros). On success the dialog closes and the profile is re-read.
  5. "Resend code" repeats step 3 (new captcha token, same provider and security password) after a 10-second countdown. The captcha is reset after every attempt.

Update Profile Email

Mutation · sso_updateProfileEmail

Adds or changes the email and sends a one-time verification code to it (step 2 of the email flow). It is also called again for "Resend code".

Arguments

NameTypeRequiredDescription
emailString!YesThe email address (trimmed and validated as an email by the form).

Variables

{
  "email": "user@example.com"
}

Request

mutation Sso_updateProfileEmail($email: String!) {
  sso_updateProfileEmail(email: $email)
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_updateProfileEmail": "String!"
  }
}

Verify Profile Email

Mutation · sso_verifyProfileEmail

Confirms the email with the code sent by sso_updateProfileEmail.

Arguments

NameTypeRequiredDescription
verificationCodeInt!YesThe 6-digit code. The UI converts the typed code with Number(), so a code with leading zeros loses them.

Variables

{
  "verificationCode": 123456
}

Request

mutation Sso_verifyProfileEmail($verificationCode: Int!) {
  sso_verifyProfileEmail(verificationCode: $verificationCode)
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_verifyProfileEmail": "String!"
  }
}

List Chat Bots by User

Query · mysabay_chatbot_listChatBotByUser

Lists the messenger bots (for example Telegram) that can deliver the phone verification code. The phone step uses the result to fill the Provider select (after the built-in SMS option) and to show the bot's name and link. It runs with fetchPolicy: "cache-and-network" and pager: { page: 1, limit: 10 } whenever the phone step is shown.

Arguments

NameTypeRequiredDescription
pagermysabay_chatbot_PagerInputNoSent by the UI.
filtermysabay_chatbot_UserChatBotFilterInputNoNot sent by the UI.

pager

FieldTypeRequiredDescription
pageInt!Yes
limitInt!Yes

filter

FieldTypeRequiredDescription
idmysabay_chatbot_MongoObjectIdFilterNoeq / ne (ID), in / nin ([ID!])
providermysabay_chatbot_MongoProviderEnumFilterNoeq / ne / in / nin over mysabay_chatbot_Provider: TELEGRAM | WHATS_APP | LINE
typemysabay_chatbot_MongoChatBotTypeEnumFilterNoeq / ne / in / nin over mysabay_chatbot_ChatBotType: VERIFICATION | ANY
botNamemysabay_chatbot_MongoStringFilterNoeq / ne (String), in / nin ([String!])

Variables

{
  "pager": {
    "page": 1,
    "limit": 10
  }
}

Request

query Mysabay_chatbot_listChatBotByUser($pager: mysabay_chatbot_PagerInput) {
  mysabay_chatbot_listChatBotByUser(pager: $pager) {
    chatBots {
      id
      serviceCode
      provider
      botName
      type
      status
      metadata
    }
    pagination {
      currentPage
      lastPage
      from
      perPage
      to
      total
    }
  }
}

Response

Generated from the schema; values show field types. The metadata keys are the ones the app's TypeScript type reads; the schema types metadata as mysabay_chatbot_JSON.

{
  "data": {
    "mysabay_chatbot_listChatBotByUser": {
      "chatBots": [
        {
          "id": "ID!",
          "serviceCode": "String!",
          "provider": "String!",
          "botName": "String!",
          "type": "String!",
          "status": "Int!",
          "metadata": {
            "bot_url": "String",
            "homepage_url": "String",
            "settings_url": "String",
            "share_contact_label": "String",
            "account_settings_label": "String"
          }
        }
      ],
      "pagination": {
        "currentPage": "Int!",
        "lastPage": "Int!",
        "from": "Int!",
        "perPage": "Int!",
        "to": "Int!",
        "total": "Int!"
      }
    }
  }
}

Add Profile Phone

Mutation · sso_addProfilePhone

Adds a phone number, or re-sends a code for an unverified one, and delivers a one-time code through the chosen provider (step 3 of the phone flow).

Arguments

NameTypeRequiredDescription
phoneString!YesThe number with country code, digits only (the UI strips the leading + and spaces).
reCaptchaTokenString!YesToken from the invisible reCAPTCHA (executeAsync()).
providersso_PhoneVerificationProvider!YesSMS | TELEGRAM | MAIL | WHATSAPP | LINE
checkPhoneVerificationBooleanNoNot sent by the UI; its effect is not documented in the schema.

Variables

{
  "phone": "85512345678",
  "reCaptchaToken": "<RECAPTCHA_TOKEN>",
  "provider": "TELEGRAM"
}

Request

mutation Sso_addProfilePhone($phone: String!, $reCaptchaToken: String!, $provider: sso_PhoneVerificationProvider!) {
  sso_addProfilePhone(
    phone: $phone
    reCaptchaToken: $reCaptchaToken
    provider: $provider
  )
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_addProfilePhone": "String!"
  }
}

Update Profile Phone (Captcha)

Mutation · sso_updateProfilePhoneCaptcha

Replaces an already verified phone number and sends a one-time code to the new one. It needs the security password.

Arguments

NameTypeRequiredDescription
phoneString!YesThe new number with country code, digits only.
securityPasswordString!YesThe account's security password (see Add Security Password if none is set).
reCaptchaTokenString!YesToken from the invisible reCAPTCHA.
providersso_PhoneVerificationProvider!YesSMS | TELEGRAM | MAIL | WHATSAPP | LINE
checkPhoneVerificationBooleanNoNot sent by the UI.

Variables

{
  "phone": "85512345678",
  "securityPassword": "<SECURITY_PASSWORD>",
  "reCaptchaToken": "<RECAPTCHA_TOKEN>",
  "provider": "SMS"
}

Request

mutation Sso_updateProfilePhoneCaptcha($phone: String!, $securityPassword: String!, $reCaptchaToken: String!, $provider: sso_PhoneVerificationProvider!) {
  sso_updateProfilePhoneCaptcha(
    phone: $phone
    securityPassword: $securityPassword
    reCaptchaToken: $reCaptchaToken
    provider: $provider
  )
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_updateProfilePhoneCaptcha": "String!"
  }
}

Verify Profile Phone

Mutation · sso_verifyProfilePhone

Confirms the phone number with the code sent by sso_addProfilePhone or sso_updateProfilePhoneCaptcha.

Arguments

NameTypeRequiredDescription
verificationCodeString!YesThe 6-digit code, sent as a string (trimmed) so leading zeros are kept.

Variables

{
  "verificationCode": "012345"
}

Request

mutation Sso_verifyProfilePhone($verificationCode: String!) {
  sso_verifyProfilePhone(verificationCode: $verificationCode)
}

Response

Generated from the schema; values show field types.

{
  "data": {
    "sso_verifyProfilePhone": "String!"
  }
}