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

Skip to main content

OryProviderProps

type OryProviderProps = {
components: OryFlowComponents
config: OryClientConfiguration
lastUsedMethodStorage?: LastUsedMethodStorage
onError?: OryErrorHandler
onSuccess?: OrySuccessHandler
onValidationError?: OryValidationErrorHandler
transientPayload?: OryTransientPayload
} & OryFlowContainer &
PropsWithChildren

Props type for the OryProvider component.

Type declaration​

NameTypeDescription
componentsOryFlowComponentsThe components to use for rendering Ory flows. You can provide custom components to override the default Ory components.
configOryClientConfigurationThe Ory client configuration. This includes the SDK and project configuration.
lastUsedMethodStorage?LastUsedMethodStorageOptional storage for the last used login method, which Ory Elements keeps when config.project.show_last_used_method is true. Defaults to window.localStorage. Pass the same storage to every OryProvider that renders a login or registration flow. Both flows record the method, and a flow without it uses window.localStorage. Define the storage outside any component, so that it is the same object on every render. Ory Elements does not call this storage while the setting is off. Example const lastUsedMethodStorage: LastUsedMethodStorage = { get: async (key) => window.sessionStorage.getItem(key), set: async (key, value) => window.sessionStorage.setItem(key, value), } export function LoginCard({ flow }: { flow: LoginFlow }) { return ( <OryProvider config={config} flow={flow} flowType={FlowType.Login} components={components} lastUsedMethodStorage={lastUsedMethodStorage} /> ) }
onError?OryErrorHandlerOptional callback invoked when a flow error occurs (expired, security violation, etc.). Use this to track error rates and detect integration issues. Example onError={(event) => { if (event.type === "flow_expired") { analytics.track("flow_expired", { flowType: event.flowType }) } }}
onSuccess?OrySuccessHandlerOptional callback invoked on successful flow completion. Use this for session stitching and post-authentication analytics. Example <OryProvider config={config} flow={flow} flowType={FlowType.Login} components={components} onSuccess={async (event) => { if (event.flowType === FlowType.Login) { await mixpanel.identify(event.session.identity.id) } }} />
onValidationError?OryValidationErrorHandlerOptional callback invoked when the flow returns validation errors. Use this to track form friction in your analytics pipeline. Example onValidationError={(event) => { analytics.track("validation_error", { flow: event.flow.id }) }}
transientPayload?OryTransientPayloadOptional transient payload to include in all flow submissions. Accepts a static object or a function that receives form values at submission time and returns the payload. Values are merged with any transient payload fields from UI nodes (e.g., captcha), with user-provided values taking priority. Examples <OryProvider config={config} flow={flow} flowType={FlowType.Registration} components={components} transientPayload={{ locale: "en-US", referral_code: "ABC123" }} /> <OryProvider config={config} flow={flow} flowType={FlowType.Registration} components={components} transientPayload={(formValues) => ({ signup_method: String(formValues.method ?? "unknown"), })} />