One-Tap Sign-In
Let existing users sign in with a single tap.
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:
- 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.
Integrating One-tap Sign-in
Implement a one-tap sign in on the desired pages.
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:
-
Enter activateReturningUsersPrompt for the method name.
-
Check to make sure the user isn’t already logged in using the
checkSession
async function. Only iffalse
the prompt will be shown. -
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.
- 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?
Was this page helpful?