Device Sign-In
Device Sign-In is the fallback when the personal agent cannot receive a Direct Sign-In browser callback. The user authenticates on the company's own page; the personal agent never handles a password, one-time password, or approval click.
Direct Sign-In is the preferred type (§4): a company that offers sign-in
should offer it, and a personal agent should use it when the company offers it.
DiscoveredCompany.preferred_sign_in (preferredSignIn(company)) says which
type to use, Direct first, and sign_in_types (signInTypes) lists every
type offered in that order. Device Sign-In is the OAuth 2.0
device authorization grant (RFC 8628),
a cross-device flow, and easier to use for phishing: whoever holds the
device_code gets the tokens, so an attacker can start a request and persuade
the user to approve it (RFC 10027
§4.1.1). Companies that offer it and personal agents that use it follow the
best practices of RFC 10027 (BCP 247) §2, including its guidance on when to
use the device grant (§6.2.1.5): it advises against it for sensitive,
high-value, or business-critical resources, so a company whose accounts hold
them, such as a bank, may offer Direct Sign-In only (CompanyConfig(device=False)).
Device Sign-In works for terminals, remote runtimes, and devices that cannot
host a callback.
The device authorization request and every poll are authenticated with a client assertion. They name no Session: a successful poll gives an access token for the account, and a Session is signed in by carrying it.
Python​
client = DeviceSignInClient(reactor=reactor, http_client=http)
started = await client.begin(
device_authorization_endpoint=metadata.device_authorization_endpoint,
token_endpoint=metadata.token_endpoint,
issuer=metadata.issuer,
client_id="https://agent.example/agent.json",
scopes=("orders:read", "orders:return"),
tenant_id="application-42",
organization=company.document.organization,
# The link must be on the issuer's host or one of its protected resources'.
# A DPoP proof goes with each poll when this includes ES256, by the DPoP key of the
# User ID the sign-in is for: one key per User ID (spec 4.5).
dpop_signing_algs=metadata.dpop_signing_alg_values_supported,
pairwise_user_id="usr_2d7b4f0c9e8a51",
)
# Render only these human-facing values. A UI may turn the complete URI into a QR.
show_to_user(started.verification_uri_complete or started.verification_uri)
show_to_user(started.user_code)
result = await client.poll(started.reference)
if result.status == "pending":
schedule_at(result.retry_at)
TypeScript​
const client = new DeviceSignInClient({ reactor, fetch });
const started = await client.begin({
deviceAuthorizationEndpoint: metadata.device_authorization_endpoint,
tokenEndpoint: metadata.token_endpoint,
issuer: metadata.issuer,
clientId: 'https://agent.example/agent.json',
scopes: ['orders:read', 'orders:return'],
tenantId: 'application-42',
organization: company.document.organization,
// A DPoP proof goes with each poll when this includes ES256, by the DPoP key of the
// User ID the sign-in is for: one key per User ID (spec 4.5).
dpopSigningAlgs: metadata.dpop_signing_alg_values_supported,
pairwiseUserId: 'usr_2d7b4f0c9e8a51',
});
renderHumanHandoff(started.verificationUriComplete ?? started.verificationUri,
started.userCode);
const result = await client.poll(started.reference, abortSignal);
begin() refuses a verification link (unsafe_verification_uri) whose host
is not the issuer's or a host of one of the issuer's protected_resources, or
a subdomain of either, and the host shows the company's organization name and
domain with the link and code. begin() returns an opaque reference, not the
device_code. poll() performs
at most one network poll. It suppresses premature calls locally, adds five
seconds after slow_down, and consumes state after success, denial, or expiry.
This makes scheduling explicit for workers and prevents an LLM loop from
accidentally hammering the company endpoint.
On success, extra scopes are rejected and missing scopes are reported. The refresh
token is written directly to the Reactor TokenStore; only its opaque reference
crosses into application code. Hosts must provide durable, encrypted,
tenant-isolated state and token stores in production.
Opening verification_uri_complete is a navigation, never approval. The user
must see the company domain and confirm the displayed code on the company's
page. Do not automate sign-in, type credentials, follow approval buttons, or
put device codes and tokens in logs, analytics, model context, QR telemetry, or
browser state.
See the runnable Device Sign-In example and the upstream Device Sign-In specification.