gray-beach-42495
10/13/2024, 1:23 PM{customerId:number, username: string} , email and password. And treat user_info as unique identifier
• Google SSO
However I'm facing an issue where if a user has an email already registered with oidc(google) it gives this error`{\"error\":{\"code\":409,\"status\":\"Conflict\",\"request\":\"29b67d3e-a694-9095-ae6c-5941fe981825\",\"reason\":\"This identity conflicts with another identity that already exists.\",\"message\":\"The resource could not be created due to a conflict\"}}`
when i try creating a user with password and user_info.
In short, is there a way to treat user_info as unique identifier and not the email (which seems to be the case right now)
Identity schema:
{
"$id": "test-identity",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"user_info": {
"type": "object",
"title": "User Information",
"properties": {
"username": {
"type": "string",
"title": "Username",
"maxLength": 100
},
"customer_id": {
"type": "number",
"title": "Customer Id"
}
},
"<http://ory.sh/kratos|ory.sh/kratos>": {
"credentials": {
"password": {
"identifier": true
},
"webauthn": {
"identifier": true
},
"totp": {
"account_name": true
}
}
}
},
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"<http://ory.sh/kratos|ory.sh/kratos>": {
"recovery": {
"via": "email"
},
"verification": {
"via": "email"
}
},
"maxLength": 320
}
},
"required": [
"user_info",
"email"
],
"additionalProperties": false
}
},
"$schema": "<http://json-schema.org/draft-07/schema#>"
}chilly-king-10285
10/13/2024, 1:23 PMchilly-king-10285
10/13/2024, 1:24 PMuser_info as a unique identifier. However, your current schema seems to be setting both user_info and email as identifiers. If you want to treat user_info as the unique identifier and not the email, you should remove the identifier: true line from the email field in your schema.
Here's an example of how you might modify your schema:
json
{
"$id": "test-identity",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"user_info": {
"type": "object",
"title": "User Information",
"properties": {
"username": {
"type": "string",
"title": "Username",
"maxLength": 100
},
"customer_id": {
"type": "number",
"title": "Customer Id"
}
},
"<http://ory.sh/kratos|ory.sh/kratos>": {
"credentials": {
"password": {
"identifier": true
},
"webauthn": {
"identifier": true
},
"totp": {
"account_name": true
}
}
}
},
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"<http://ory.sh/kratos|ory.sh/kratos>": {
"recovery": {
"via": "email"
},
"verification": {
"via": "email"
}
},
"maxLength": 320
}
},
"required": [
"user_info",
"email"
],
"additionalProperties": false
}
},
"$schema": "<http://json-schema.org/draft-07/schema#>"
}
Please note that this change will make the email field no longer serve as an identifier for password-based authentication. It will still be used for recovery and verification purposes.
Also, keep in mind that the user_info object as a whole is being treated as the identifier in this schema, not the individual username and customer_id fields. If you want each of these fields to be unique identifiers, you would need to set identifier: true for each of them individually.
Finally, remember that changing the identity schema can have significant implications for your application, so it's important to thoroughly test these changes before deploying them to a production environment.chilly-king-10285
10/13/2024, 1:24 PMgray-beach-42495
10/13/2024, 1:26 PMchilly-king-10285
10/13/2024, 1:26 PMchilly-king-10285
10/13/2024, 1:26 PM