bland-lawyer-16132
09/04/2025, 8:56 AMupdateRegistrationFlow
, 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?chilly-king-10285
09/04/2025, 8:56 AMchilly-king-10285
09/04/2025, 8:56 AMbland-lawyer-16132
09/04/2025, 8:58 AMupdateRegistrationFlow
, 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?chilly-king-10285
09/04/2025, 8:58 AMchilly-king-10285
09/04/2025, 8:59 AMupdateRegistrationFlow
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): 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: 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.