helpful-application-20084
11/09/2025, 12:34 AM@override
Future<void> requestOtpCode({required String email}) async {
try {
final result = await oryClient.getFrontendApi().createNativeLoginFlow();
final codeMethod = UpdateLoginFlowWithCodeMethod(
(b) => b
..method = 'code'
..identifier = email
..csrfToken = '',
)..toBuilder().build();
await oryClient.getFrontendApi().updateLoginFlow(
flow: result.data!.id,
updateLoginFlowBody: UpdateLoginFlowBody((builder) => builder.oneOf = NO IDEA),
);
} catch (e, st) {
log('$e\n$st', name: 'OryAuthSource.requestOtpCode');
rethrow;
}
}helpful-application-20084
11/09/2025, 2:52 PM@override
Future<void> requestOtpCode({required String email}) async {
try {
final result = await oryClient.getFrontendApi().createNativeRegistrationFlow();
final codeMethod = UpdateLoginFlowWithCodeMethod(
(b) => b
..method = 'code'
..identifier = email
..csrfToken = '',
);
final builder = UpdateRegistrationFlowBodyBuilder()
..oneOf = OneOfDynamic(
typeIndex: 0,
types: [
UpdateLoginFlowWithCodeMethod,
],
value: codeMethod,
);
await oryClient.getFrontendApi().updateRegistrationFlow(
flow: result.data!.id,
updateRegistrationFlowBody: builder.build(),
);
} catch (e, st) {
log('$e\n$st', name: 'OryAuthSource.requestOtpCode');
rethrow;
}
}
I installed the OneOf package from pub.dev but know I'm having this exception:
[OryAuthSource.requestOtpCode] DioException [bad response]: This exception was thrown because the response has a status code of 400 and RequestOptions.validateStatus was configured to throw for this status code.
The status code of 400 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled"