New Ory Agent Security is now live! Claim your complimentary test drive. Get Started!

Skip to main content

OnSubmitHandlerProps<T>

type OnSubmitHandlerProps<T> = {
body: T
onError?: OryErrorHandler
onRecordLastUsedMethod?: (entry: LastUsedMethod) => Promise<void>
onRedirect: OnRedirectHandler
onSuccess?: OrySuccessHandler
onValidationError?: OryValidationErrorHandler
setFlowContainer: (flowContainer: OryFlowContainer) => void
}

Props for the submit handler

Type Parameters​

Type Parameter
T extends | UpdateLoginFlowBody | UpdateRegistrationFlowBody | UpdateVerificationFlowBody | UpdateRecoveryFlowBody | UpdateSettingsFlowBody

Properties​

body​

body: T

The form values to submit.


onError?​

optional onError: OryErrorHandler;

Optional callback invoked on infrastructure or flow-level errors (expired flow, CSRF, not found, replaced). Awaited if it returns a Promise.


onRecordLastUsedMethod()?​

optional onRecordLastUsedMethod: (entry: LastUsedMethod) => Promise<void>;

Optional callback that records the method the user signed in or signed up with, for the "Last used" badge. Only login and registration submissions call it: before the browser leaves for a single sign-on provider, and after the server accepts a password, code, passkey or WebAuthn submission. The submission waits for it at most 250 milliseconds and ignores its errors.

Parameters​

ParameterType
entryLastUsedMethod

Returns​

Promise<void>


onRedirect​

onRedirect: OnRedirectHandler

This method is used to redirect the user to a different page.


onSuccess?​

optional onSuccess: OrySuccessHandler;

Optional callback invoked after a successful submission, before the default behavior (redirect, flow update). Awaited if it returns a Promise.


onValidationError?​

optional onValidationError: OryValidationErrorHandler;

Optional callback invoked when the server returns validation errors. Awaited if it returns a Promise.


setFlowContainer()​

setFlowContainer: (flowContainer: OryFlowContainer) => void;

This method is used to update the flow container when a validation error occurs, for example.

Parameters​

ParameterType
flowContainerOryFlowContainer

Returns​

void