Hello, we are using the Ory network with an identi...
# ory-network
r
Hello, we are using the Ory network with an identity schema containing both an
email
and a
phoneNumber
. We use the email as identifier for a email/password login and then the phoneNumber for MFA. We'd like to allow users with two different accounts (let's say their personal and their profesionnal email address) to use the same
phoneNumber
but unfortunately this throws and
4000007 : "An account with the same identifier (email, phone, username, ...) exists already."
error. Any idea how we could do that? Thanks!
This is our identity schema:
Copy code
{
  "$schema": "<http://json-schema.org/draft-07/schema#>",
  "$id": "<https://schemas.ory.sh/presets/kratos/identity.email.schema.json>",
  "title": "Person",
  "type": "object",
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "first_name": {
          "title": "First Name",
          "type": "string"
        },
        "last_name": {
          "title": "Last Name",
          "type": "string"
        },
        "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
              }
            },
            "recovery": {
              "via": "email"
            },
            "verification": {
              "via": "email"
            }
          },
          "maxLength": 320
        },
        "phoneNumber": {
          "type": "string",
          "format": "tel",
          "title": "Phone Number",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "verification": {
              "via": "sms"
            }
          }
        },
        "preferences": {
          "type": "object",
          "properties": {
            "locale": {
              "type": "string",
              "title": "Locale",
              "enum": [
                "en",
                "fr"
              ]
            },
            "investorAppMode": {
              "type": "string",
              "title": "Investor App Mode",
              "enum": [
                "standard",
                "web3"
              ]
            },
            "theme": {
              "type": "string",
              "title": "Theme",
              "enum": [
                "light",
                "dark",
                "system"
              ]
            }
          },
          "required": [
            "locale",
            "investorAppMode"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "first_name",
        "last_name",
        "email",
        "preferences"
      ],
      "additionalProperties": false
    }
  }
}