Account Recovery
Learn how to set up account recovery on your website frontend
Account Recovery automates the process of re-authenticating users who forgot or had an issue with their password or existing device.
Prerequisites
To get the most out of this guide, make sure to do the following tasks first:
-
Complete the backend integrations (see Build Server-Side Endpoints).
-
Complete the Login integration (see Login).
The instructions on this page assume you have already installed and referenced the OwnID SDK as described in Steps 1 and 2 of Login.
Add the Widget to your Account Recovery Form
The SDK recover method is used to integrate with the account recovery journey. It references the field Ids in your existing recovery form. It also renders the OwnId widget automatically referencing your field Ids to calculate its position in the DOM.
The sample recover forms in the snippets below are vanilla examples, shown here only to confirm the implementation pattern of form fields in SDK methods.
Implementation Overview
In the ownid method:
-
Enter “recover” for the method name.
-
Assign the form field (as a DOM element) you use as the login id to the
loginIdField
parameter. -
Assign the the same field (as a DOM element) you use as the login id to the
targetIdField
parameter. -
Assign an error function as desired in the
onError
parameter. -
Configure the
onLogin
event to copy thedata.token
object locally. Thedata.token
is the value generated by thegetSessionByLoginId
endpoint and you should use it to set a user session or exchange it for a session token.
Session identifier can be ANY data Object
As noted in the Login integration, the session identifier can be any unique data object, even though we’re calling it a ‘token’. We only pass it right back to you so you’re able to associate a request with an active session.
- Redirect the user to the appropriate landing page at your discretion.
Use the code snippets below, and check the embedded comments, to model your implementation of the submit handler and the SDK recover method.
Styling Options
The OwnID recover widget can be styled in three different ways to match your application’s design:
Default Button
The default implementation places the OwnID button side by side with the password field. This is the standard configuration and requires no additional styling parameters.
Default button variant (Example for michaelkors.com)Standalone Button
For cases where you want to position the OwnID button independently from the password field, use the standalone button variant:
Standalone button variant (Example for nfl.com)Note: in the code sample above, button-wrapper-div
represents the div where the button will be shown. Configure your own.
This creates a separate OwnID button that you can position anywhere in your login form.
If you would like to style this button, you can utilize the following CSS variables:
Prompt Account Recovery on mobile devices
When users forget their passwords, offering biometric authentication as a recovery method provides a seamless and secure experience.
When implemented, users will see a modal overlay presenting two options:
-
Use biometric authentication (Face ID/Touch ID)
-
Set a traditional password
Implementation Overview
The account recovery prompt can be activated using OwnID’s SDK:
Was this page helpful?