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).
Figure 1. After integration (example)
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
loginIdFieldparameter. -
Assign the the same field (as a DOM element) you use as the login id to the
targetIdFieldparameter. -
Assign an error function as desired in the
onErrorparameter. -
Configure the
onLoginevent to copy thedata.tokenobject locally. Thedata.tokenis the value generated by thegetSessionByLoginIdendpoint and you should use it to set a user session or exchange it for a session token.
Session identifier can be ANY data ObjectAs 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.
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)
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: