Open Nelfimov opened 1 year ago
@Nelfimov Hi, I finally found a solution after really a long time of digging. I had the same problem as you. So, first of all, we missing a lot of documentation on the dart client. You will need two package in order to have it working: OneOf and built_value.
Then I had it working doing so (this is maybe not the best way of doing it but since it was a error and try attempt, I didn't wanted to loose more time having it working):
final Response<SuccessfulNativeRegistration> response;
final JsonObject jsonObject = JsonObject(registrationModel.toJson());
final UpdateRegistrationFlowBody registrationFlowBody =
UpdateRegistrationFlowBody(
(UpdateRegistrationFlowBodyBuilder flow) => flow
..oneOf = OneOf.fromValue1(
value: UpdateRegistrationFlowWithPasswordMethod(
(UpdateRegistrationFlowWithPasswordMethodBuilder builder) => builder
..csrfToken = ''
..traits = jsonObject
..method = 'password'
..password = registrationModel.password,
),
),
);
response = await _oryFrontEnd.updateRegistrationFlow(
flow: url,
updateRegistrationFlowBody: registrationFlowBody,
);
Hope it will help you in future development !
Preflight checklist
Ory Network Project
No response
Describe the bug
updateRegistrationFlowBody
requiresflow
- Flow ID as stringupdateRegistrationFlowBody
- builder function to create flow bodyUnfortunately creating
UpdateRegistrationFlowBody
provides onlyoneOf
, whereas auto-generated docs describe the required for me arguments likemethod
,traits
and so on.I have tried creating flow body with following snippets with no success:
1
```dart final body = UpdateRegistrationFlowBody((b) => b ..oneOf = UpdateRegistrationFlowWithPasswordMethod((p) => p ..password = password ..traits = Traits((t) => t..email = email))); kratosClient .updateRegistrationFlow( flow: registrationFlow.id, updateRegistrationFlowBody: body, ) ```2
```dart final body = UpdateRegistrationFlowBody((b) => b ..oneOf = OneOfThis package however provides needed function to create flow body -
SubmitSelfServiceRegistrationFlowBody
Reproducing the bug
Relevant log output
No response
Relevant configuration
No response
Version
0.13.1
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
None
Additional Context
No response