<@U04UQ68083H> when signing up with `updateRegistr...
# ory-copilot
b
@chilly-king-10285 when signing up with
updateRegistrationFlow
, we want to pass the user name as well to be stored during signup. How can we pass the user name? Is it inside updateRegistrationFlowBody? And what's the format of updateRegistrationFlowBody to pass the user name with it?
c
A message from kapa.ai
Sorry @bland-lawyer-16132, I'm currently experiencing some technical difficulties. Please try again in a few minutes. If this issue persists, please reach out to the administrators of this Slack workspace.
b
@chilly-king-10285 when signing up with
updateRegistrationFlow
, we want to pass the user name as well to be stored during signup. How can we pass the user name? Is it inside updateRegistrationFlowBody? And what's the format of updateRegistrationFlowBody to pass the user name with it?
c
A message from kapa.ai
Yes, you can pass the user name during signup using the
updateRegistrationFlow
endpoint. The user name should be included as part of the
traits
object inside the
updateRegistrationFlowBody
. The exact structure of the
traits
object depends on your identity schema configuration, but typically, you would include a field like
traits.username
or
traits.name
. Here’s an example of how to format the
updateRegistrationFlowBody
to include a user name (assuming your identity schema expects a
username
trait):
Copy code
json {   "method": "password",   "password": "your-password",   "traits": {     "email": "<mailto:user@example.com|user@example.com>",     "username": "desired-username"   },   "csrf_token": "your-csrf-token" }
If you are using the Ory SDK in JavaScript/TypeScript, it would look like this:
Copy code
ts await frontendAPI.updateRegistrationFlow({   flow: flowId,   updateRegistrationFlowBody: {     method: "password",     password: "your-password",     traits: {       email: "<mailto:user@example.com|user@example.com>",       username: "desired-username"     },     csrf_token: "your-csrf-token"   } })
Make sure that your identity schema includes the
username
field under
traits
, otherwise Ory Kratos will ignore or reject the field. The
traits
object is where all user profile information (like email, username, etc.) is stored during registration. The rest of the fields (
method
,
password
,
csrf_token
) are required for the password registration method. You can also include optional fields like
transient_payload
if needed for webhooks or other integrations [Submit registration flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-registration-flow) [Kratos API Reference](https://raw.githubusercontent.com/ory/kratos/master/spec/api.json). If you need to see the required fields for your specific registration flow, inspect the
flow.ui.nodes
property when initializing or fetching the registration flow, as it will list all expected form fields based on your schema [Submit registration flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-registration-flow). Summary: - Pass the user name as a field inside the
traits
object in
updateRegistrationFlowBody
. - The format is determined by your identity schema (e.g.,
traits.username
). - Example payloads are shown above.