Open JacobMillward opened 1 year ago
Hey @JacobMillward
Have you gotten errors form Ory Kratos when submitting the registration payload provided by Ory Elements? I believe Ory Kratos flat maps the object when giving the ui form fields.
For example:
{
traits: {
email: string
}
}
will become <input type="email" name="traits.email" />
inside the UI since Kratos' flow payload returns the UI node names flat mapped as shown here https://github.com/ory/elements/blob/main/src/stories/Ory/register-flow.json#L70-L78.
Have you gotten errors form Ory Kratos when submitting the registration payload provided by Ory Elements?
Yup I did. Kratos kept giving back the error that the email could not be empty. My workaround was to unflatten it e.g.
await kratos.updateRegistrationFlow({
flow: String(flow?.id),
updateRegistrationFlowBody: {
...formBody,
traits: {
email: (formBody as any)["traits.email"],
},
},
});
Hmm interesting :thinking: Could you share your identity schema?
Sure. It's the example from the kratos helm configuration page
{
"$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": "Email",
"ory.sh/kratos":
{
"credentials": { "password": { "identifier": true } },
"recovery": { "via": "email" },
"verification": { "via": "email" },
},
},
},
"required": ["email"],
"additionalProperties": false,
},
},
}
Preflight checklist
Describe the bug
When submitting the a registration form using
UserAuthCard
, thebody
object returned to the callback on theonSubmit
prop formats the object incorrectly. What is expected is:What is given is:
This means that unless care is taken, form values are not passed up to kratos correctly.
Reproducing the bug
onSubmit
callbackRelevant log output
No response
Relevant configuration
No response
Version
0.0.1-beta.3
On which operating system are you observing this issue?
Other
In which environment are you deploying?
Kubernetes with Helm
Additional Context
No response