Hello, we want to verify user phone number, here's...
# ory-network
f
Hello, we want to verify user phone number, here's the identity-schema
Copy code
"phone": {
   "type": "string",
   "title": "Phone"
   "format": "tel",
      "<http://ory.sh/kratos|ory.sh/kratos>": {
          "verification": {
            "via": "sms"
          }
       }
   },
We're able to get the verification message sent to our backend:webhook on setting the
traits.phone
(phone trait is set and have unverified flag on it) via
SettingFlow
, but are unable to get the verification flow for submitting the code How do you trigger phone verification? when we're trying to
createBrowserVerificationFlow
, the
choose_method
response only have email option in it
s
f
on updated the verifiable address I only get
redirect_browser_to
in the
continue_with
response
Copy code
"continue_with": [
    {
      "action": "redirect_browser_to",
      "redirect_browser_to": "<http://andy-ubuntu:4000/ui/settings?flow=807e35fb-00e5-426c-ac74-e0aab0b4b029>"
    }
  ]
update: if we remove the email verification from identity-schema, then we get the
show_verification_ui
on updated the
traits.phone
Copy code
"continue_with": [
        {
            "action": "show_verification_ui",
            "flow": {
                "id": "3c2c8771-bc43-46bd-b411-412b7e0c4dae",
                "verifiable_address": "+6281312781223",
                "url": "<http://andy-ubuntu:4000/ui/verification?flow=3c2c8771-bc43-46bd-b411-412b7e0c4dae>"
            }
        },
        {
            "action": "redirect_browser_to",
            "redirect_browser_to": "<http://andy-ubuntu:4000/ui/settings?flow=22ec417b-497e-4ee3-a351-78c056f3c858>"
        }
    ]
but we need to be able to verify both the email and phone
update: another issue we're facing removing the email verification alllow me to verify the phone, but when triggering
loginFlow:aal2
it only returns email in the nodes for mfa
Copy code
"nodes": [
            {
                "type": "input",
                "group": "default",
                "attributes": {
                    "name": "csrf_token",
                    ...
                },
                "messages": [],
                "meta": {}
            },
            {
                "type": "input",
                "group": "code",
                "attributes": {
                    "name": "address",
                    "type": "submit",
                    ...
                },
                "messages": [],
                "meta": {
                    "label": {
                        ...
                    }
                }
            }
        ],
my identity schema already include these
Copy code
"phone": {
  "type": "string",
  "title": "Phone",
   "format": "tel",
     "ory.sh/kratos": {
        "verification": {
           "via": "sms"
         },
        "credentials": {
           "code": {
             "identifier": true,
             "via": "sms"
            }
         }
     }
 },
m
any ideas @steep-lamp-91158?
s
can you share the full identity schema?
f
Copy code
{
  "$id": "<https://schemas.ory.sh/presets/kratos/identity.email.schema.json>",
  "$schema": "<http://json-schema.org/draft-07/schema#>",
  "title": "Person",
  "type": "object",
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "title": "E-Mail",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              },
              "webauthn": {
                "identifier": true
              },
              "totp": {
                "account_name": true
              },
              "code": {
                "identifier": true,
                "via": "email"
              },
              "passkey": {
                "display_name": true
              }
            },
            "recovery": {
              "via": "email"
            },
            "verification": {
              "via": "email"
            }
          },
          "maxLength": 320
        },
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "title": "First name",
              "type": "string"
            },
            "last": {
              "title": "Last name",
              "type": "string"
            }
          }
        },
        "phone": {
          "type": "string",
          "title": "Phone",
          "format": "tel",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "verification": {
              "via": "sms"
            }
          }
        },
        "date_of_birth": {
          "type": "string",
          "title": "Date Of Birth"
        },
        "referral_code": {
          "type": "string",
          "title": "Referral Code"
        },
        "general_consent_version": {
          "type": "string",
          "title": "General Consent Version"
        }
      },
      "required": [
        "email",
        "name",
        "general_consent_version"
      ],
      "additionalProperties": false
    }
  }
}
@steep-lamp-91158
s
I cannot really reproduce what you described. Can you try to recreate the steps on my project https://elated-thompson-xz1ynatvwg.projects.oryapis.com/ui? I have set up your identity schema and also this webhook target so you can see what messages arrive https://webhook.site/#!/view/57e022dd-77a5-4557-91d9-5059c76aca21
f
I created account on that, I'm able to change the phone number in account-setting area the webhook do receive the code but no way to use this code? (this is the same behaviour we are experiencing)
m
@steep-lamp-91158 any ideas?
this is blocking us
b
The email object we send out should contain a link to the form/the flow ID, does it not? And for MFA via SMS you need to set the
selfservice.methods.code.mfa_enabled
property to true.
f
yeah the email object does contain a link for verification with the email code, but we are not having issue with email
and we already have the mfa enabled, but the flow response when updating the phone number in setting-flow does not contain flow_id for verifying it
Copy code
...
"methods": {
            "code": {
                "config": {
                    "lifespan": "15m0s"
                },
                "enabled": true,
                "mfa_enabled": true,
                "passwordless_enabled": false,
                "passwordless_login_fallback_enabled": false
            },
...
@bland-eye-99092
m
@steep-lamp-91158 any ideas here?
b
That could be a bug in the settings flow. Could you create an issue on Github https://github.com/ory/kratos/issues/new/choose? Thank you.
f