Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.
The device authorization grant (RFC 8628) lets a CLI, SDK, or any input-constrained device authenticate a user without requiring a browser on the same machine. The device displays a short code or URL; the user completes login on any browser they have available.PymtHouse extends the standard RFC 8628 flow with optional third-party initiate login (OIDC Core §4): unauthenticated users can be redirected to your own login UI instead of PymtHouse’s default login page.
When to use device flow
Use this pattern when:
Your integration runs as a CLI tool, background daemon, or terminal app.
The user’s device has limited or no browser access at the point of authentication.
You want to bridge an existing IdP session (NaaP / Option B) into PymtHouse without requiring a second login.
Full URL with user_code, client_id, iss pre-filled
Use for clickable links, QR codes, and deep-links
Step 2 — Display the code to the user
Show either the short URL with the user_code to type in, or present the verification_uri_complete as a clickable link or QR code.
Open https://pymthouse.com/oidc/deviceand enter the code: ABCD-EFGHOr scan the QR code / click this link:https://pymthouse.com/oidc/device?user_code=ABCD-EFGH&…
Step 3 — Poll for the token
Begin polling the token endpoint at the interval specified in the response. Do not poll faster than the interval — the server will respond with slow_down and increase the interval.
Increase the polling interval by at least 5 seconds.
access_denied
User denied the request.
Abort and surface the error.
expired_token
device_code has expired.
Restart the flow with a new device code request.
(no error)
Authentication complete.
Read access_token and id_token from the response.
Third-party initiate login (Option B / NaaP)
When device_third_party_initiate_login is enabled on the public client, unauthenticated users who open verification_uri_complete are redirected to your registered initiate_login_uri with:
GET https://yourapp.example/login/initiate ?iss=https%3A%2F%2Fpymthouse.com%2Fapi%2Fv1%2Foidc &target_link_uri=https%3A%2F%2Fpymthouse.com%2Fapi%2Fv1%2Foidc%2Fdevice%3F… &login_hint=<optional>
Your initiate_login_uri endpoint must:
Validate iss against your discovery document. Reject if it does not equal the expected issuer.
Validate target_link_uri — ensure it points to your PymtHouse origin and the /oidc/device path. Reject open redirects.
Show an approval confirmation page or redirect to target_link_uri.
The initiate_login_uri is loaded from the database for the client_id. The endpoint does not accept an arbitrary initiate_login_uri query parameter. This is intentional to prevent open-redirect attacks.
Security requirements for your initiate login endpoint
Use HTTPS in production. HTTP on localhost is permitted for local development only.
Apply CSRF protection on any form that triggers your IdP login.
The OP sets a short-lived per-client cookie so that a failed relying-party round-trip does not loop redirects indefinitely.
Implied consent
When the user opens verification_uri_complete with a pre-filled user_code, PymtHouse skips the secondary authorization confirmation step after a successful lookup — the user already authenticated at your site. This improves UX by avoiding double-confirmation for users who completed login through the third-party initiate flow.
Key design decisions
verification_uri_complete carries iss alongside user_code. Including the issuer in the URL allows the device verification page to validate that the user_code was issued by this deployment and not by a phishing URL. It also enables the third-party initiate redirect to carry context without requiring a server-side lookup.
Redirect target is database-loaded, not URL-provided. Accepting an arbitrary initiate_login_uri query parameter would allow a crafted device-auth link to redirect any user to an attacker-controlled URL. Loading the URI from the client registration prevents this class of open-redirect vulnerability.
Third-party device login must be explicitly opt-in. Defaulting to a redirect to the relying party would silently change the user experience for every device session. Requiring explicit opt-in means the impact of enabling the feature is deliberate and visible.
RFC 8628 polling semantics are enforced server-side.slow_down responses enforce back-off at the server rather than trusting clients to self-regulate. This protects the token endpoint under high load or misbehaving clients.
Implementation tasks
Validate that your device code flow handler parses and acts on every polling error code — particularly slow_down and expired_token.
If using third-party initiate, register initiate_login_uri as an HTTPS URL; verify it strictly matches iss from discovery before trusting any payload.
Enable CSRF protection on your initiate_login_uri handler.
Do not display device_code to the user — it is a server-side opaque token. Display only user_code and the verification URLs.
After binding the device grant with RFC 8693 (Option B), verify the CLI poll returns a successful token before showing the “device approved” page to the browser.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"PymtHouse","colors":{"primary":"#16A34A","light":"#07C983","dark":"#15803D"},"logo":{"light":"https://mintcdn.com/elitecodesolutions/AkUSp5f5h68RxGdy/logo/light.svg?fit=max\u0026auto=format\u0026n=AkUSp5f5h68RxGdy\u0026q=85\u0026s=100343a4103de541688743f00b166337","dark":"https://mintcdn.com/elitecodesolutions/AkUSp5f5h68RxGdy/logo/dark.svg?fit=max\u0026auto=format\u0026n=AkUSp5f5h68RxGdy\u0026q=85\u0026s=8ce9b3cb4ad5a512418e813a1b40688f"},"favicon":"https://mintcdn.com/elitecodesolutions/AkUSp5f5h68RxGdy/favicon.svg?fit=max\u0026auto=format\u0026n=AkUSp5f5h68RxGdy\u0026q=85\u0026s=44acdc771df5ccc001980cb959e86073","contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/eliteprox/pymthouse"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"elitecodesolutions","hasAudioNarration":false,"actualSubdomain":"elitecodesolutions","customDomains":["docs.pymthouse.com"],"gitSource":{"type":"github","owner":"pymthouse","repo":"pymthouse-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae95584bb9827c4f4fc677d:success","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Builder guides","count":21},{"language":"default","tag":"Billing","count":4},{"language":"default","tag":"Authentication","count":4},{"language":"default","tag":"Getting started","count":3},{"language":"default","tag":"Users","count":3},{"language":"default","tag":"Core concepts","count":3},{"language":"default","tag":"Help","count":2},{"language":"default","tag":"Infrastructure","count":2},{"language":"default","tag":"API reference","count":1},{"language":"default","tag":"Overview","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"integration/device-flow","slug":"/integration/device-flow","pageMetadata":{"title":"Device flow","description":"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.","href":"/integration/device-flow"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The `,_jsx(_components.strong,{children:`device authorization grant`}),` (RFC 8628) lets a CLI, SDK, or any input-constrained device authenticate a user without requiring a browser on the same machine. The device displays a short code or URL; the user completes login on any browser they have available.`]}),`\n`,_jsxs(_components.p,{children:[`PymtHouse extends the standard RFC 8628 flow with optional `,_jsx(_components.strong,{children:`third-party initiate login`}),` (OIDC Core §4): unauthenticated users can be redirected to your own login UI instead of PymtHouse’s default login page.`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-to-use-device-flow`,children:`When to use device flow`}),`\n`,_jsx(_components.p,{children:`Use this pattern when:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Your integration runs as a CLI tool, background daemon, or terminal app.`}),`\n`,_jsx(_components.li,{children:`The user’s device has limited or no browser access at the point of authentication.`}),`\n`,_jsx(_components.li,{children:`You want to bridge an existing IdP session (NaaP / Option B) into PymtHouse without requiring a second login.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`For browser-based authentication, use `,_jsx(_components.a,{href:`/integration/interactive-login`,children:`Interactive login`}),` instead.`]}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.strong,{children:`public`}),` OIDC client (`,_jsx(_components.code,{children:`app_…`}),`) with the `,_jsx(_components.code,{children:`device_code`}),` grant enabled.`]}),`\n`,_jsxs(_components.li,{children:[`If using third-party initiate: `,_jsx(_components.code,{children:`device_third_party_initiate_login`}),` must be enabled on the public client, and an `,_jsx(_components.code,{children:`initiate_login_uri`}),` must be registered.`]}),`\n`,_jsxs(_components.li,{children:[`If completing the device grant from your backend (Option B): a `,_jsx(_components.strong,{children:`confidential M2M client`}),` (`,_jsx(_components.code,{children:`m2m_…`}),`) with `,_jsx(_components.code,{children:`users:token`}),` or `,_jsx(_components.code,{children:`device:approve`}),` scope.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-full-flow`,children:`The full flow`}),`\n`,_jsx(Mermaid,{chart:`sequenceDiagram\n participant Device as CLI / device\n participant User as Browser (any device)\n participant RP as Your backend (Option B only)\n participant OP as PymtHouse\n\n Device->>OP: 1. POST /oidc/device/auth\n OP-->>Device: device_code, user_code, verification_uri_complete\n Device->>User: Display code or URL\n\n User->>OP: 2. Open verification_uri_complete\n OP-->>User: 302 → initiate_login_uri (if third-party initiate enabled)\n User->>RP: 3. Login at your IdP\n RP->>OP: 4. RFC 8693 token exchange (binds device grant)\n OP-->>RP: 200 bound\n\n Device->>OP: 5. Poll POST /oidc/token (grant_type=device_code)\n OP-->>Device: access_token, id_token`}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-—-request-a-device-code`,children:`Step 1 — Request a device code`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -sS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/x-www-form-urlencoded\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"client_id=${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`PUBLIC_CLIENT_ID`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"scope=openid\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`BASE_URL`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}/api/v1/oidc/device/auth\"`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Response:`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"device_code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Ag_EE…long…\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"user_code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ABCD-EFGH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"verification_uri\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://pymthouse.com/oidc/device\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"verification_uri_complete\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://pymthouse.com/oidc/device?user_code=ABCD-EFGH\u0026client_id=app_…\u0026iss=https%3A%2F%2F…\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"expires_in\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`600`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"interval\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`verification_uri`}),` vs `,_jsx(_components.code,{children:`verification_uri_complete`}),`:`]})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Format`}),_jsx(_components.th,{children:`Use`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`verification_uri`})}),_jsx(_components.td,{children:`Short URL, easy to type`}),_jsx(_components.td,{children:`Display when the user will type the code manually`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`verification_uri_complete`})}),_jsxs(_components.td,{children:[`Full URL with `,_jsx(_components.code,{children:`user_code`}),`, `,_jsx(_components.code,{children:`client_id`}),`, `,_jsx(_components.code,{children:`iss`}),` pre-filled`]}),_jsx(_components.td,{children:`Use for clickable links, QR codes, and deep-links`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-—-display-the-code-to-the-user`,children:`Step 2 — Display the code to the user`}),`\n`,_jsxs(_components.p,{children:[`Show either the short URL with the `,_jsx(_components.code,{children:`user_code`}),` to type in, or present the `,_jsx(_components.code,{children:`verification_uri_complete`}),` as a clickable link or QR code.`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Open https://pymthouse.com/oidc/device`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`and enter the code: ABCD-EFGH`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Or scan the QR code / click this link:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`https://pymthouse.com/oidc/device?user_code=ABCD-EFGH\u0026…`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-—-poll-for-the-token`,children:`Step 3 — Poll for the token`}),`\n`,_jsxs(_components.p,{children:[`Begin polling the token endpoint at the `,_jsx(_components.code,{children:`interval`}),` specified in the response. Do `,_jsx(_components.strong,{children:`not`}),` poll faster than the interval — the server will respond with `,_jsx(_components.code,{children:`slow_down`}),` and increase the interval.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`23`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` RESPONSE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -sS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/x-www-form-urlencoded\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"grant_type=urn:ietf:params:oauth:grant-type:device_code\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"device_code=${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`DEVICE_CODE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"client_id=${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`PUBLIC_CLIENT_ID`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`BASE_URL`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}/api/v1/oidc/token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ERROR`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RESPONSE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` jq`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -r`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '.error // empty'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [ `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-z`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ERROR`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]; `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authenticated!\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ACCESS_TOKEN`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RESPONSE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` jq`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -r`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '.access_token'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` elif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [ `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:'\"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ERROR`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"authorization_pending\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]; `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` sleep`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` elif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [ `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:'\"${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ERROR`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"slow_down\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]; `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`then`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` sleep`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` else`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' \"Error: ${'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ERROR`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` fi`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`done`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Poll response codes:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsxs(_components.th,{children:[_jsx(_components.code,{children:`error`}),` value`]}),_jsx(_components.th,{children:`Meaning`}),_jsx(_components.th,{children:`Action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`authorization_pending`})}),_jsx(_components.td,{children:`User has not yet completed login.`}),_jsxs(_components.td,{children:[`Wait and retry after `,_jsx(_components.code,{children:`interval`}),` seconds.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`slow_down`})}),_jsx(_components.td,{children:`You are polling too fast.`}),_jsx(_components.td,{children:`Increase the polling interval by at least 5 seconds.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`access_denied`})}),_jsx(_components.td,{children:`User denied the request.`}),_jsx(_components.td,{children:`Abort and surface the error.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`expired_token`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`device_code`}),` has expired.`]}),_jsx(_components.td,{children:`Restart the flow with a new device code request.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.em,{children:`(no error)`})}),_jsx(_components.td,{children:`Authentication complete.`}),_jsxs(_components.td,{children:[`Read `,_jsx(_components.code,{children:`access_token`}),` and `,_jsx(_components.code,{children:`id_token`}),` from the response.`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`third-party-initiate-login-option-b-/-naap`,children:`Third-party initiate login (Option B / NaaP)`}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`device_third_party_initiate_login`}),` is enabled on the public client, unauthenticated users who open `,_jsx(_components.code,{children:`verification_uri_complete`}),` are redirected to your registered `,_jsx(_components.strong,{children:_jsx(_components.code,{children:`initiate_login_uri`})}),` with:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`5`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`GET https://yourapp.example/login/initiate`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ?iss=https%3A%2F%2Fpymthouse.com%2Fapi%2Fv1%2Foidc`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \u0026target_link_uri=https%3A%2F%2Fpymthouse.com%2Fapi%2Fv1%2Foidc%2Fdevice%3F…`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \u0026login_hint=\u003coptional>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Your `,_jsx(_components.code,{children:`initiate_login_uri`}),` endpoint must:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Validate `,_jsx(_components.code,{children:`iss`})]}),` against your discovery document. Reject if it does not equal the expected issuer.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Validate `,_jsx(_components.code,{children:`target_link_uri`})]}),` — ensure it points to your PymtHouse origin and the `,_jsx(_components.code,{children:`/oidc/device`}),` path. Reject open redirects.`]}),`\n`,_jsx(_components.li,{children:`Complete the user’s login at your own IdP.`}),`\n`,_jsxs(_components.li,{children:[`Call `,_jsx(_components.code,{children:`POST {issuer}/token`}),` with an RFC 8693 token exchange to bind the device grant (see `,_jsx(_components.a,{href:`/integration/token-exchange#device-completion`,children:`Token exchange — device completion`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`Show an approval confirmation page or redirect to `,_jsx(_components.code,{children:`target_link_uri`}),`.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`initiate_login_uri`}),` is loaded from the database for the `,_jsx(_components.code,{children:`client_id`}),`. The endpoint does `,_jsx(_components.strong,{children:`not`}),` accept an arbitrary `,_jsx(_components.code,{children:`initiate_login_uri`}),` query parameter. This is intentional to prevent open-redirect attacks.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`security-requirements-for-your-initiate-login-endpoint`,children:`Security requirements for your initiate login endpoint`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Use `,_jsx(_components.strong,{children:`HTTPS`}),` in production. HTTP on `,_jsx(_components.code,{children:`localhost`}),` is permitted for local development only.`]}),`\n`,_jsxs(_components.li,{children:[`Apply `,_jsx(_components.strong,{children:`CSRF protection`}),` on any form that triggers your IdP login.`]}),`\n`,_jsx(_components.li,{children:`The OP sets a short-lived per-client cookie so that a failed relying-party round-trip does not loop redirects indefinitely.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`implied-consent`,children:`Implied consent`}),`\n`,_jsxs(_components.p,{children:[`When the user opens `,_jsx(_components.code,{children:`verification_uri_complete`}),` with a pre-filled `,_jsx(_components.code,{children:`user_code`}),`, PymtHouse skips the secondary authorization confirmation step after a successful lookup — the user already authenticated at your site. This improves UX by avoiding double-confirmation for users who completed login through the third-party initiate flow.`]}),`\n`,_jsx(Heading,{level:`2`,id:`key-design-decisions`,children:`Key design decisions`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`verification_uri_complete`}),` carries `,_jsx(_components.code,{children:`iss`}),` alongside `,_jsx(_components.code,{children:`user_code`}),`.`]}),` Including the issuer in the URL allows the device verification page to validate that the `,_jsx(_components.code,{children:`user_code`}),` was issued by this deployment and not by a phishing URL. It also enables the third-party initiate redirect to carry context without requiring a server-side lookup.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Redirect target is database-loaded, not URL-provided.`}),` Accepting an arbitrary `,_jsx(_components.code,{children:`initiate_login_uri`}),` query parameter would allow a crafted device-auth link to redirect any user to an attacker-controlled URL. Loading the URI from the client registration prevents this class of open-redirect vulnerability.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Third-party device login must be explicitly opt-in.`}),` Defaulting to a redirect to the relying party would silently change the user experience for every device session. Requiring explicit opt-in means the impact of enabling the feature is deliberate and visible.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`RFC 8628 polling semantics are enforced server-side.`}),` `,_jsx(_components.code,{children:`slow_down`}),` responses enforce back-off at the server rather than trusting clients to self-regulate. This protects the token endpoint under high load or misbehaving clients.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`implementation-tasks`,children:`Implementation tasks`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Validate that your device code flow handler parses and acts on every polling error code — particularly `,_jsx(_components.code,{children:`slow_down`}),` and `,_jsx(_components.code,{children:`expired_token`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`If using third-party initiate, register `,_jsx(_components.code,{children:`initiate_login_uri`}),` as an HTTPS URL; verify it strictly matches `,_jsx(_components.code,{children:`iss`}),` from discovery before trusting any payload.`]}),`\n`,_jsxs(_components.li,{children:[`Enable CSRF protection on your `,_jsx(_components.code,{children:`initiate_login_uri`}),` handler.`]}),`\n`,_jsxs(_components.li,{children:[`Do not display `,_jsx(_components.code,{children:`device_code`}),` to the user — it is a server-side opaque token. Display only `,_jsx(_components.code,{children:`user_code`}),` and the verification URLs.`]}),`\n`,_jsx(_components.li,{children:`After binding the device grant with RFC 8693 (Option B), verify the CLI poll returns a successful token before showing the “device approved” page to the browser.`}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Device flow","description":"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.","href":"/integration/device-flow"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"When to use device flow","slug":"when-to-use-device-flow","depth":2,"children":[]},{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"The full flow","slug":"the-full-flow","depth":2,"children":[]},{"title":"Step 1 — Request a device code","slug":"step-1-—-request-a-device-code","depth":2,"children":[]},{"title":"Step 2 — Display the code to the user","slug":"step-2-—-display-the-code-to-the-user","depth":2,"children":[]},{"title":"Step 3 — Poll for the token","slug":"step-3-—-poll-for-the-token","depth":2,"children":[]},{"title":"Third-party initiate login (Option B / NaaP)","slug":"third-party-initiate-login-option-b-/-naap","depth":2,"children":[{"title":"Security requirements for your initiate login endpoint","slug":"security-requirements-for-your-initiate-login-endpoint","depth":3,"children":[]}]},{"title":"Implied consent","slug":"implied-consent","depth":2,"children":[]},{"title":"Key design decisions","slug":"key-design-decisions","depth":2,"children":[]},{"title":"Implementation tasks","slug":"implementation-tasks","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"elitecodesolutions","siteName":"PymtHouse","title":"Device flow - PymtHouse","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-13T01:58:06.397Z","originalFileLocation":"integration/device-flow.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.\">\u003cmeta data-mint-head name=\"application-name\" content=\"PymtHouse\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Device flow - PymtHouse\">\u003cmeta data-mint-head property=\"og:description\" content=\"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"PymtHouse\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.pymthouse.com/integration/device-flow\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://elitecodesolutions.mintlify.site/_mintlify/api/og/v2?division=Authentication\u0026amp;title=Device+flow\u0026amp;description=Authenticate+users+from+CLI+tools%2C+set-top+boxes%2C+and+limited-input+devices+using+RFC+8628+device+authorization+with+optional+third-party+initiate+login.\u0026amp;theme=564edb3c141d7a1d3a685d7b\u0026amp;signature=0aa33d63450561df9d366a61971d7993cb92b395640be9ca596d0bbf1d4adaaf\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Device flow - PymtHouse\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://elitecodesolutions.mintlify.site/_mintlify/api/og/v2?division=Authentication\u0026amp;title=Device+flow\u0026amp;description=Authenticate+users+from+CLI+tools%2C+set-top+boxes%2C+and+limited-input+devices+using+RFC+8628+device+authorization+with+optional+third-party+initiate+login.\u0026amp;theme=564edb3c141d7a1d3a685d7b\u0026amp;signature=0aa33d63450561df9d366a61971d7993cb92b395640be9ca596d0bbf1d4adaaf\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/elitecodesolutions/DStq26iN35-qfk-b/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"PymtHouse\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A34A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.pymthouse.com/integration/device-flow\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/integration/device-flow.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.pymthouse.com/#organization\",\"name\":\"PymtHouse\",\"url\":\"https://docs.pymthouse.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/elitecodesolutions/AkUSp5f5h68RxGdy/logo/light.svg?fit=max\u0026auto=format\u0026n=AkUSp5f5h68RxGdy\u0026q=85\u0026s=100343a4103de541688743f00b166337\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.pymthouse.com#website\",\"name\":\"PymtHouse\",\"url\":\"https://docs.pymthouse.com\",\"publisher\":{\"@id\":\"https://docs.pymthouse.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.pymthouse.com/integration/device-flow#webpage\",\"url\":\"https://docs.pymthouse.com/integration/device-flow\",\"name\":\"Device flow\",\"description\":\"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.\",\"dateModified\":\"2026-08-13T01:58:06.397Z\",\"isPartOf\":{\"@id\":\"https://docs.pymthouse.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.pymthouse.com/integration/device-flow#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.pymthouse.com/integration/device-flow#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Authentication\",\"item\":\"https://docs.pymthouse.com/integration/machine-access\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Device flow\",\"item\":\"https://docs.pymthouse.com/integration/device-flow\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.pymthouse.com/integration/device-flow#article\",\"headline\":\"Device flow\",\"name\":\"Device flow\",\"description\":\"Authenticate users from CLI tools, set-top boxes, and limited-input devices using RFC 8628 device authorization with optional third-party initiate login.\",\"url\":\"https://docs.pymthouse.com/integration/device-flow\",\"mainEntityOfPage\":{\"@id\":\"https://docs.pymthouse.com/integration/device-flow#webpage\"},\"dateModified\":\"2026-08-13T01:58:06.397Z\",\"publisher\":{\"@id\":\"https://docs.pymthouse.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.pymthouse.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"PymtHouse\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"PymtHouse\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/integration/device-flow.md","siteName":"PymtHouse","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/eliteprox/pymthouse"}]},"tabs":[{"tab":"Builder guides","groups":[{"group":"Getting started","pages":[{"title":"PymtHouse Docs","href":""},{"title":"Quickstart","href":"/quickstart"},{"title":"Integration patterns","href":"/integration/integration-patterns"}]},{"group":"Core concepts","pages":[{"title":"Client model","href":"/integration/client-model"},{"title":"API keys","href":"/integration/api-keys"},{"title":"Builder SDK","href":"/integration/sdk"}]},{"group":"Authentication","pages":[{"title":"Machine access","href":"/integration/machine-access"},{"title":"Interactive login","description":"Authenticate end-users with PymtHouse using the OAuth 2.0 authorization code flow with PKCE.","href":"/integration/interactive-login"},{"title":"Device flow","href":"/integration/device-flow"},{"title":"Token exchange","description":"Use OAuth 2.0 Token Exchange (RFC 8693) to complete device authorization, obtain a remote signer session, or mint a user signer token via the clearinghouse.","href":"/integration/token-exchange"}]},{"group":"Users","pages":[{"title":"User management","href":"/integration/user-management"},{"title":"User-scoped JWTs","href":"/integration/user-tokens"},{"title":"Allowances","href":"/integration/allowances"}]},{"group":"Billing","pages":[{"title":"Billing summary","href":"/integration/billing"},{"title":"Plans","href":"/integration/plans"},{"title":"Usage API","href":"/integration/usage-api"},{"title":"Builder M2M Payments API","href":"/integration/payments"}]},{"group":"Infrastructure","pages":[{"title":"Signer routing","href":"/integration/signer-routing"},{"title":"App manifest","href":"/integration/manifest"}]},{"group":"Help","pages":[{"title":"Troubleshooting","href":"/integration/troubleshooting"},{"title":"Deprecated routes and migrations","href":"/integration/deprecated"}]}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Device flow - PymtHouse","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}