otpless-headless-sdk v2.1.0.
Flow overview
- Call
start(authConfig)to let the SDK drive the entire flow, or fetch the bound identities yourself withgetDeviceBoundIdentities()and pass a selection tostart(identity, authConfig, callback). - Handle the
ONETAPresponse for the final token. When you usestart(authConfig), also handleAUTO_FLOW_ACTIONfor picker lifecycle events. - 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
falseand 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 fromgetDeviceBoundIdentities().
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 aONETAP 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. Returnstrue on HTTP success, false if the SDK is not initialized or the call fails.
Dismiss the picker
CallOtplessSDK.closeDialogIfOpen() to programmatically dismiss the OneTap picker — for example when your activity moves away from the login screen.