Login via OTP Code Device Pairing
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
The Passwordless Login with OTP Code Device Pairing feature allows users to securely authenticate without a password by pairing a new device with an already authenticated device. This mechanism supports bidirectional pairing:
From a logged-in device to a new device
From a new device to a logged-in device
Key benefits:
Strong security using short-lived OTP codes.
Seamless user experience with minimal interaction.
Device management through X-Device-* headers for device metadata.
This flow is initiated from a logged-in device (Device A) to authorize a new device (Device B).
Generate OTP Code from Device A
Authorization: Auth-Key
of Device A
Response: ID
and code
of OTP.
Display OTP Code to Device B
Device B input the OTP code.
Device A approves pairing
Response: { status: "Approved" }
.
Device B polls pairing status
Status updates to APPROVED
after confirmation by Device A.
Device B logs in
Headers: X-Device-*
for device metadata.
Response: { authKey, refreshAuthKey }
.
This flow allows a new device (Device B) to initiate pairing, which is approved by the logged-in device (Device A).
Device B generates OTP Code
Authentication: No authentication required.
Headers:
X-Device-Token
: Used to send a push notification via data message after the OTP code is successfully approved.
Response: ID
and code
of OTP.
Device B polls OTP code status
Poll interval: ~3 seconds.
Waits until status=Approved
.
Device A approves pairing
Authorization: Auth-Key
of Device A.
Status is updated to APPROVED
.
Device B completes login
Headers: X-Device-*
for device metadata.
API responds with authentication tokens and upserts device record.
📔 Notes: If the client includes the X-Device-Token
header during OTP code generation, the server will send a push notification (data message) to that device after the OTP is approved.
Push Notification Payload Example:
{
"id": "4f7e124d-0f46-4a5b-a0c8-1fd88a3b3ca3",
"code": "483600",
"status": "Approved",
"approvedAt": "2025-08-19T07:57:35.0092387Z"
}
OTP codes are single-use and time-limited to prevent replay attacks.
Auth-Key ensures device-level authorization for approval actions.
Tokens (authKey & refreshKey) are issued only after pairing confirmation.
Device metadata headers (X-Device-*
) are required to register the device securely.
The OTP code-based passwordless login mechanism enables secure, bidirectional device pairing. Users can:
Authorize new devices from a logged-in device.
Initiate pairing from a new device and have it approved by an existing device.
This system ensures security, ease of use, and full device traceability.