Skip to main content
Device-bound background authentication lets a returning user sign in without re-entering their phone number, email, or OTP. When the merchant has one or more identities bound to the device, the SDK can either silently authenticate the single bound identity or show a picker if multiple are available. Available from otpless-headless-sdk v2.1.0.

Flow overview

  1. Call start(authConfig) to let the SDK drive the entire flow, or fetch the bound identities yourself with getDeviceBoundIdentities() and pass a selection to start(identity, authConfig, callback).
  2. Handle the ONETAP response for the final token. When you use start(authConfig), also handle AUTO_FLOW_ACTION for picker lifecycle events.
  3. Call removeDeviceBoundIdentity(identity) when the user wants to unlink a saved identity.

Start with the SDK-driven flow

start(authConfig) is the simplest way to trigger background auth. It automatically handles the following cases:
  • If one identity is bound and identity-discovery UI is disabled on the dashboard, it silently starts auth for that identity.
  • If multiple identities are bound, it shows the built-in OneTap picker.
  • If no identities are bound, it returns false and does nothing.
start(authConfig) returns true when a flow was launched, false otherwise. The final result is delivered through the callback registered in initialize / setResponseCallback. This overload is the only entry point that emits AUTO_FLOW_ACTION responses — see Handle responses below.

List device-bound identities

Returns the identities the backend has bound to this device for the merchant. Use it when you want to render your own selection UI instead of the SDK’s OneTap picker.
VerifiedContact exposes the contact value, provider name, contact type (PHONE / EMAIL), and a stable uuid.

Start with a merchant-selected identity

Use this overload when you render your own selection UI from getDeviceBoundIdentities().
This overload skips the built-in picker and goes straight to authentication. It delivers the final result as a ONETAP response on the supplied callback — it does not emit AUTO_FLOW_ACTION.

OtplessAuthConfig

Both start overloads take an OtplessAuthConfig.

Handle responses

The final identity token always arrives as a ONETAP response in your normal onOtplessResponse callback. Picker lifecycle events and background-auth failures arrive as AUTO_FLOW_ACTION — only when the flow was started via OtplessSDK.start(authConfig). The merchant-selected identity overload (start(identity, authConfig, callback)) does not emit AUTO_FLOW_ACTION.

AUTO_FLOW_ACTION codes

Remove a device-bound identity

Delinks the given identity from this device. Returns true on HTTP success, false if the SDK is not initialized or the call fails.

Dismiss the picker

Call OtplessSDK.closeDialogIfOpen() to programmatically dismiss the OneTap picker — for example when your activity moves away from the login screen.

API summary