Skip to main content
useSession exposes the one active TapSession the provider holds. With autoVerify left on (the default), EndstateProvider captures and verifies the landing redirect tap on mount, so session and item populate without any call of your own. status drives the UI while that runs, moving idle -> capturing -> verifying -> verified, or to error on failure. item is a convenience: it is session?.item ?? null, the verified unit read straight off the session with no extra request.

Example

To verify a tap you captured yourself - for example when autoVerify is false, or after collecting a value through your own interface - call verify with the TapInput:

Returns

TapSession | null
The active session, or null until a tap is verified. Opened bound to the tap, so session.claims.create({to}) and session.transfers.create({to}) read unit_id from its scope.
TapResponse["unit"] | null
The verified unit ({(id, external_id, name, attributes, collection)}), read off the session with no extra request. null until status reaches "verified".
SessionStatus
Where capture-and-verify stands: "idle" before it starts, "capturing" while reading the tap, "verifying" during the verify request, "verified" once a session exists, and "error" on failure. Branch the UI on this.
Error | null
The failure that moved status to "error", or null. For typed error codes and what retries automatically, see Errors and retries.
(tap: TapInput) => Promise<TapSession>
Verifies a tap you captured yourself and adopts the resulting session as the active one. Use it when autoVerify is off or to verify a scanned tap.

See also

EndstateProvider

The provider that owns the session and runs autoVerify.

useTap

Trigger an in-page Web NFC scan and verify it.

TapSession

What the session is and what it authorizes.

Tap sessions

The session lifecycle and scope.