Returning users can be automatically prompted for a single tap to log back in, no matter where they are on the site.

Prerequisites

To get the most out of this guide, make sure to do the following tasks first:

  1. Complete the backend integrations (see Build Server-Side Endpoints).
  2. Complete the Login integration (see Login).

Integrating One-Tap Sign In

Widget 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.

Integrating One-tap Sign-in

Implement the event handlers, and OwnID integration on the desired page.

Add the Pop-Up Prompt to your Page

The SDK activateReturningUsersPrompt method is used to integrate with the one-tap sign-in journey. It starts by offering users on the site a pop-up to login by clicking the Continue button shown in Figure 1, if they’re not already logged in.

Implement the activateReturningUsersPrompt Method

In the ownid method:

  1. Enter “activateReturningUsersPrompt” for the method name.

  2. Check to make sure the user isn’t already logged in.

Show prompt only to logged out users
// only if `false` then the prompt will be shown 
checkSession: async () => { 
    // use your own method to check for if the user is logged in
    return this.authService.isLoggedIn(); 
}
  1. Configure the onLogin event to copy the data.token object locally. The data.token is the value generated by the getSessionByLoginId 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.

  1. Redirect the user to the appropriate landing page at your discretion.

  2. Assign an error function as desired in the onError parameter.

Use the code snippets below, and check the embedded comments, to model your implementation of the submit handler and the SDK activateReturningUsersPrompt method.

That’s it!

You’ve implemented the frontend functionality required to allow registered users who aren’t logged in to get a prompt to login with one tap from any page.

If you’re ready to deploy your integration, make sure to read the Pre-Deployment Checklist before hand!

Next Steps

Ready to deploy?