Concepts

Cross-device Flow

Order states, events, and device responsibilities.

An order is the shared record between the initiating device, the approving device, and your proof adapter. The order lets both devices coordinate without sharing the same bearer token.

Overview

StageInitiating deviceApproving deviceServer
StartCreates the order and displays claimUrl.Not involved yet.Stores a short-lived created order.
ClaimSubscribes to events with eventToken.Opens the claim URL with claimToken.Issues challengeToken.
ChallengeWaits for an event.Reads the challenge and asks the user to approve.Builds the adapter challenge envelope.
ApproveReceives approved.Submits proof with challengeToken.Verifies the proof through your adapter.
FinalizeUses desktopToken to consume the result.Done.Marks the order finalized and returns session or proof data.
Tokens are role-specific. The approving device never gets the desktopToken, and the initiating device never uses the challengeToken.

States

StateMeaning
createdThe initiating device created an order and can show the claim URL.
claimedThe approving device exchanged the claim token for a challenge token.
waiting_userThe approving device is showing the challenge to the user.
approvedThe adapter verified the proof.
rejectedThe approving device rejected the order.
expiredThe order passed its TTL.
cancelledThe initiating device cancelled the order.
finalizedThe initiating device consumed the approved result.

approved is not terminal. It means the proof passed verification, but the initiating device still needs to finalize the order.

Events

The event stream emits claimed, waiting_user, approved, rejected, expired, cancelled, and finalized.

follow-order.ts
authClient.crossDevice.subscribe({
  orderId,
  eventToken,
  onEvent(event, payload) {
    console.log(event, payload.status, payload.redirectTo)
  },
})

Terminal events are rejected, expired, cancelled, and finalized. Close the stream after one of those events.

Tokens

TokenHeld byPurpose
claimTokenApproving device via claim URLClaim an order.
challengeTokenApproving deviceRead and answer the challenge.
desktopTokenInitiating deviceCancel or finalize the order.
eventTokenInitiating deviceSubscribe to status changes.

Failure paths

FailureResult
Claim token is wrong or expiredClaim fails and no challenge token is issued.
Proof is invalidAdapter throws CrossDeviceProofError; order remains protected from finalization.
Order passes its TTLThe next lifecycle read marks it expired.
Initiating device cancelsThe order becomes cancelled and cannot be approved.
Finalize is called twiceThe second call is rejected after the finalized result is consumed.

Next Steps

Copyright © 2026