accessToken field. Send the OwnID access-token to your server with the custom-action request. Your server must verify and validate the OwnID access-token before it performs the action.
Trigger the flow
The following example starts a flow when the user selects a custom-action button. It allows the user to complete any one of passkey authentication, phone number verification, or identity document verification.withContext()identifies the account for which authentication is required.buildFlow()creates a custom flow. The flow name is included in metrics, so use a stable, descriptive name for each action.requireAuth()defines the acceptable authentication evidence.start()presents an available method to the user and begins the flow.whenSettledresolves after the flow succeeds or fails. A successful result contains the OwnID access-token inaccessToken.- The browser sends the OwnID access-token to the endpoint responsible for the custom action.
Choose authentication requirements
Pass a policy torequireAuth() that reflects the sensitivity of the action:
- Use a method name to require that specific method.
- Use
oneOfto accept at least one method from a list. - Use
allOfto require every method in a list.
Only methods available for the account and configured for your OwnID application can be completed. For example, phone verification requires an SMS provider, and email verification requires an email provider.
Authorize the action on your server
Treat the OwnID access-token (JWT) as a short-lived credential for the requested action. Send it over HTTPS in the request body or an authorization header, and do not store it in browser persistence or log it. On your server, verify the JWT signature and standard claims on the OwnID access-token, prevent replay, confirm the expected authentication evidence inauthorization_details, and identify the account from the subject claim. See Custom Actions Authentication for a complete server-side implementation.