Skip to content
Eskais UI

Accounts

Device Code Prompt

DeviceCodePrompt: the "go to this address and enter this code" step of a sign-in by device code (OAuth device authorization, RFC 8628) at a third-party provider. The code through PairingCode (grouped, monospaced, spelled out for screen readers, with copy), the verification page as an external link that opens in a new tab, an Open button that prefers the address with the code filled in, an optional copy of the link, and a countdown that announces itself sparingly and switches to expired. Agents never read the code or the link by default.

Example

Sign in at the provider
Approve this app on the provider's site to link your account.

Go to provider.example/device (opens in a new tab) and enter this code.

W D J B, M J H T

Code expires in 10:00

Installation

npx shadcn@latest add @eskais/device-code-prompt

Usage

Import
import { deviceCodePrompt } from "@/components/ui/device-code-prompt-primitive"import { DeviceCodePrompt, deviceCodePromptLabels } from "@/components/ui/device-code-prompt"

The sign-in step of a device code flow (RFC 8628) at a third-party provider: go to this address and enter this code. Put it in ConnectedAccount's waiting slot, or anywhere a person links an account by code.

API reference

DeviceCodePrompt

Takes DataAttributes &.

Other exports

deviceCodePromptdeviceCodePromptLabelstype DeviceCodePromptOptionstype DeviceCodePromptStatetype DeviceCodePromptLabelstype DeviceCodePromptPropstype DeviceCodePromptText

Accessibility

  • The code is PairingCode's: grouped for the eye and spelled out a character at a time for screen readers.
  • The verification page is an external link that says it opens in a new tab; Open opens it without an opener.
  • The countdown is a timer that isn't live, announced once a minute and at 30, 20 and 10 seconds, and the expiry once.

Agent actions

The code and the link are hidden from agents by default, since the code signs an account in: they stay out of the snapshot and queries, and open, copyLink and the code's copy fail the step with why. agentHidden={false} lets agents read the link, open and copy it.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.