[{"data":1,"prerenderedAt":687},["ShallowReactive",2],{"navigation":3,"\u002Fsign-in\u002Fdevices":178,"\u002Fsign-in\u002Fdevices-surround":682},[4,23,78,95,123,143,158],{"title":5,"path":6,"stem":7,"children":8,"icon":22},"Getting Started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,12,17],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-house",{"title":13,"path":14,"stem":15,"icon":16},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Configuration","\u002Fgetting-started\u002Fconfiguration","1.getting-started\u002F3.configuration","i-lucide-settings",false,{"title":24,"icon":22,"path":25,"stem":26,"children":27,"page":22},"Sign-in","\u002Fsign-in","2.sign-in",[28,33,38,43,48,53,58,63,68,73],{"title":29,"path":30,"stem":31,"icon":32},"Sign-in pages","\u002Fsign-in\u002Fpages","2.sign-in\u002F1.pages","i-lucide-log-in",{"title":34,"path":35,"stem":36,"icon":37},"Several accounts","\u002Fsign-in\u002Fmulti-session","2.sign-in\u002F10.multi-session","i-lucide-users-round",{"title":39,"path":40,"stem":41,"icon":42},"Account page","\u002Fsign-in\u002Faccount","2.sign-in\u002F2.account","i-lucide-circle-user",{"title":44,"path":45,"stem":46,"icon":47},"Other methods","\u002Fsign-in\u002Fmethods","2.sign-in\u002F3.methods","i-lucide-key-square",{"title":49,"path":50,"stem":51,"icon":52},"Sign-in providers","\u002Fsign-in\u002Fproviders","2.sign-in\u002F4.providers","i-lucide-share-2",{"title":54,"path":55,"stem":56,"icon":57},"Two-factor","\u002Fsign-in\u002Ftwo-factor","2.sign-in\u002F5.two-factor","i-lucide-shield-check",{"title":59,"path":60,"stem":61,"icon":62},"Passkeys","\u002Fsign-in\u002Fpasskeys","2.sign-in\u002F6.passkeys","i-lucide-fingerprint",{"title":64,"path":65,"stem":66,"icon":67},"Phone numbers","\u002Fsign-in\u002Fphone-numbers","2.sign-in\u002F7.phone-numbers","i-lucide-smartphone",{"title":69,"path":70,"stem":71,"icon":72},"Signing in devices","\u002Fsign-in\u002Fdevices","2.sign-in\u002F8.devices","i-lucide-tv",{"title":74,"path":75,"stem":76,"icon":77},"Security","\u002Fsign-in\u002Fsecurity","2.sign-in\u002F9.security","i-lucide-lock-keyhole",{"title":79,"path":80,"stem":81,"children":82,"icon":22},"Organizations","\u002Forganizations","3.organizations\u002F1.index",[83,85,90],{"title":79,"path":80,"stem":81,"icon":84},"i-lucide-building-2",{"title":86,"path":87,"stem":88,"icon":89},"Roles","\u002Forganizations\u002Froles","3.organizations\u002F2.roles","i-lucide-shield",{"title":91,"path":92,"stem":93,"icon":94},"Single sign-on","\u002Forganizations\u002Fsso","3.organizations\u002F3.sso","i-lucide-key-round",{"title":96,"path":97,"stem":98,"children":99,"icon":22},"Admin dashboard","\u002Fadmin","4.admin\u002F1.index",[100,103,108,113,118],{"title":101,"path":97,"stem":98,"icon":102},"Overview","i-lucide-layout-dashboard",{"title":104,"path":105,"stem":106,"icon":107},"Managing users","\u002Fadmin\u002Fusers","4.admin\u002F2.users","i-lucide-user-cog",{"title":109,"path":110,"stem":111,"icon":112},"Staff roles","\u002Fadmin\u002Froles","4.admin\u002F3.roles","i-lucide-shield-user",{"title":114,"path":115,"stem":116,"icon":117},"Audit log","\u002Fadmin\u002Faudit-log","4.admin\u002F4.audit-log","i-lucide-history",{"title":119,"path":120,"stem":121,"icon":122},"Your own pages","\u002Fadmin\u002Fextending","4.admin\u002F5.extending","i-lucide-layout-panel-left",{"title":124,"icon":22,"path":125,"stem":126,"children":127,"page":22},"Integrations","\u002Fintegrations","5.integrations",[128,133,138],{"title":129,"path":130,"stem":131,"icon":132},"Stripe","\u002Fintegrations\u002Fstripe","5.integrations\u002F1.stripe","i-simple-icons-stripe",{"title":134,"path":135,"stem":136,"icon":137},"API keys","\u002Fintegrations\u002Fapi-keys","5.integrations\u002F2.api-keys","i-lucide-key",{"title":139,"path":140,"stem":141,"icon":142},"Tokens","\u002Fintegrations\u002Ftokens","5.integrations\u002F3.tokens","i-lucide-ticket",{"title":144,"icon":22,"path":145,"stem":146,"children":147,"page":22},"Customization","\u002Fcustomization","6.customization",[148,153],{"title":149,"path":150,"stem":151,"icon":152},"Emails","\u002Fcustomization\u002Femails","6.customization\u002F1.emails","i-lucide-mail",{"title":154,"path":155,"stem":156,"icon":157},"Languages","\u002Fcustomization\u002Flanguages","6.customization\u002F2.languages","i-lucide-languages",{"title":159,"icon":22,"path":160,"stem":161,"children":162,"page":22},"Reference","\u002Freference","7.reference",[163,168,173],{"title":164,"path":165,"stem":166,"icon":167},"How it works","\u002Freference\u002Fhow-it-works","7.reference\u002F1.how-it-works","i-lucide-cog",{"title":169,"path":170,"stem":171,"icon":172},"API reference","\u002Freference\u002Fapi","7.reference\u002F2.api","i-lucide-braces",{"title":174,"path":175,"stem":176,"icon":177},"Contributing","\u002Freference\u002Fcontributing","7.reference\u002F3.contributing","i-lucide-git-pull-request",{"id":179,"title":69,"body":180,"description":675,"extension":676,"links":677,"meta":678,"navigation":679,"path":70,"seo":680,"stem":71,"__hash__":681},"docs\u002F2.sign-in\u002F8.devices.md",{"type":181,"value":182,"toc":669},"minimark",[183,188,192,203,208,390,400,404,410,430,437,441,447,596,609,613,665],[184,185],"screenshot",{"alt":186,"name":187},"The device page: a TV app asking to sign in, with its code, a warning, and Deny or Approve","device",[189,190,191],"p",{},"For apps on devices without a browser or keyboard: a TV, a console, a CLI, a desktop app. The device shows \"Go to\nexample.com\u002Fdevice and enter ABCD-1234\", and the person approves it from their phone or computer.",[189,193,194,195,202],{},"It's Better Auth's ",[196,197,201],"a",{"href":198,"rel":199},"https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fplugins\u002Fdevice-authorization",[200],"nofollow","Device Authorization plugin",", the\nOAuth device grant (RFC 8628).",[204,205,207],"h2",{"id":206},"turning-it-on","Turning it on",[209,210,212,217,379,383],"steps",{"level":211},"3",[213,214,216],"h3",{"id":215},"enable-it-and-list-your-apps","Enable it, and list your apps",[218,219,225],"pre",{"className":220,"code":221,"filename":222,"language":223,"meta":224,"style":224},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  betterAuthUi: {\n    deviceAuthorization: {\n      enabled: true,\n      \u002F\u002F The apps allowed to ask, by client_id, with the name the page shows.\n      clients: {\n        'tv-app': 'Our TV app',\n        'our-cli': 'Our CLI'\n      }\n    }\n  }\n})\n","nuxt.config.ts","ts","",[226,227,228,252,265,275,290,297,307,332,352,358,364,370],"code",{"__ignoreMap":224},[229,230,233,237,240,244,248],"span",{"class":231,"line":232},"line",1,[229,234,236],{"class":235},"s7zQu","export",[229,238,239],{"class":235}," default",[229,241,243],{"class":242},"s2Zo4"," defineNuxtConfig",[229,245,247],{"class":246},"sTEyZ","(",[229,249,251],{"class":250},"sMK4o","{\n",[229,253,255,259,262],{"class":231,"line":254},2,[229,256,258],{"class":257},"swJcz","  betterAuthUi",[229,260,261],{"class":250},":",[229,263,264],{"class":250}," {\n",[229,266,268,271,273],{"class":231,"line":267},3,[229,269,270],{"class":257},"    deviceAuthorization",[229,272,261],{"class":250},[229,274,264],{"class":250},[229,276,278,281,283,287],{"class":231,"line":277},4,[229,279,280],{"class":257},"      enabled",[229,282,261],{"class":250},[229,284,286],{"class":285},"sfNiH"," true",[229,288,289],{"class":250},",\n",[229,291,293],{"class":231,"line":292},5,[229,294,296],{"class":295},"sHwdD","      \u002F\u002F The apps allowed to ask, by client_id, with the name the page shows.\n",[229,298,300,303,305],{"class":231,"line":299},6,[229,301,302],{"class":257},"      clients",[229,304,261],{"class":250},[229,306,264],{"class":250},[229,308,310,313,316,319,321,324,328,330],{"class":231,"line":309},7,[229,311,312],{"class":250},"        '",[229,314,315],{"class":257},"tv-app",[229,317,318],{"class":250},"'",[229,320,261],{"class":250},[229,322,323],{"class":250}," '",[229,325,327],{"class":326},"sfazB","Our TV app",[229,329,318],{"class":250},[229,331,289],{"class":250},[229,333,335,337,340,342,344,346,349],{"class":231,"line":334},8,[229,336,312],{"class":250},[229,338,339],{"class":257},"our-cli",[229,341,318],{"class":250},[229,343,261],{"class":250},[229,345,323],{"class":250},[229,347,348],{"class":326},"Our CLI",[229,350,351],{"class":250},"'\n",[229,353,355],{"class":231,"line":354},9,[229,356,357],{"class":250},"      }\n",[229,359,361],{"class":231,"line":360},10,[229,362,363],{"class":250},"    }\n",[229,365,367],{"class":231,"line":366},11,[229,368,369],{"class":250},"  }\n",[229,371,373,376],{"class":231,"line":372},12,[229,374,375],{"class":250},"}",[229,377,378],{"class":246},")\n",[213,380,382],{"id":381},"run-better-auths-migrations","Run Better Auth's migrations",[189,384,385,386,389],{},"The plugin adds a ",[226,387,388],{},"deviceCode"," table.",[391,392,393],"warning",{},[189,394,395,396,399],{},"Without ",[226,397,398],{},"clients",", any client id is accepted (Better Auth's default) and the page shows the raw id. The module warns\nat build time: set it in production.",[204,401,403],{"id":402},"the-approval-page","The approval page",[189,405,406,409],{},[226,407,408],{},"\u002Fdevice"," is for signed-in people; others sign in first and come back with their code. It:",[411,412,413,421,424,427],"ol",{},[414,415,416,417,420],"li",{},"takes the code, or reads it from ",[226,418,419],{},"?user_code="," when the device shows a link;",[414,422,423],{},"shows which app is asking, and what access it wants;",[414,425,426],{},"warns not to approve a code someone else sent;",[414,428,429],{},"approves or denies it.",[189,431,432,433,436],{},"Approvals are recorded in the ",[196,434,435],{"href":115},"audit log",". The signed-in device shows on the account page's Devices\ntab, where it can be signed out.",[204,438,440],{"id":439},"the-device-side","The device side",[189,442,443,444,261],{},"Asking for a code and waiting for approval is your app's job, with Better Auth's ",[226,445,446],{},"deviceAuthorizationClient",[218,448,450],{"className":220,"code":449,"language":223,"meta":224,"style":224},"const { data } = await authClient.device.code({ client_id: 'tv-app' })\n\u002F\u002F Show data.user_code and data.verification_uri, then every `interval` seconds:\nconst { data: token } = await authClient.device.token({\n  grant_type: 'urn:ietf:params:oauth:grant-type:device_code',\n  device_code: data.device_code,\n  client_id: 'tv-app'\n})\n",[226,451,452,505,510,545,561,577,590],{"__ignoreMap":224},[229,453,454,458,461,464,466,469,472,475,478,480,482,484,486,489,492,494,496,498,500,503],{"class":231,"line":232},[229,455,457],{"class":456},"spNyl","const",[229,459,460],{"class":250}," {",[229,462,463],{"class":246}," data ",[229,465,375],{"class":250},[229,467,468],{"class":250}," =",[229,470,471],{"class":235}," await",[229,473,474],{"class":246}," authClient",[229,476,477],{"class":250},".",[229,479,187],{"class":246},[229,481,477],{"class":250},[229,483,226],{"class":242},[229,485,247],{"class":246},[229,487,488],{"class":250},"{",[229,490,491],{"class":257}," client_id",[229,493,261],{"class":250},[229,495,323],{"class":250},[229,497,315],{"class":326},[229,499,318],{"class":250},[229,501,502],{"class":250}," }",[229,504,378],{"class":246},[229,506,507],{"class":231,"line":254},[229,508,509],{"class":295},"\u002F\u002F Show data.user_code and data.verification_uri, then every `interval` seconds:\n",[229,511,512,514,516,519,521,524,526,528,530,532,534,536,538,541,543],{"class":231,"line":267},[229,513,457],{"class":456},[229,515,460],{"class":250},[229,517,518],{"class":257}," data",[229,520,261],{"class":250},[229,522,523],{"class":246}," token ",[229,525,375],{"class":250},[229,527,468],{"class":250},[229,529,471],{"class":235},[229,531,474],{"class":246},[229,533,477],{"class":250},[229,535,187],{"class":246},[229,537,477],{"class":250},[229,539,540],{"class":242},"token",[229,542,247],{"class":246},[229,544,251],{"class":250},[229,546,547,550,552,554,557,559],{"class":231,"line":277},[229,548,549],{"class":257},"  grant_type",[229,551,261],{"class":250},[229,553,323],{"class":250},[229,555,556],{"class":326},"urn:ietf:params:oauth:grant-type:device_code",[229,558,318],{"class":250},[229,560,289],{"class":250},[229,562,563,566,568,570,572,575],{"class":231,"line":292},[229,564,565],{"class":257},"  device_code",[229,567,261],{"class":250},[229,569,518],{"class":246},[229,571,477],{"class":250},[229,573,574],{"class":246},"device_code",[229,576,289],{"class":250},[229,578,579,582,584,586,588],{"class":231,"line":299},[229,580,581],{"class":257},"  client_id",[229,583,261],{"class":250},[229,585,323],{"class":250},[229,587,315],{"class":326},[229,589,351],{"class":250},[229,591,592,594],{"class":231,"line":309},[229,593,375],{"class":250},[229,595,378],{"class":246},[189,597,598,599,603,604,608],{},"Once approved, that returns a Better Auth session token, used with the ",[196,600,602],{"href":601},"\u002Fintegrations\u002Ftokens#bearer-tokens","Bearer plugin",".\nSee Better Auth's ",[196,605,607],{"href":198,"rel":606},[200],"device authorization docs"," for the\nfull flow.",[204,610,612],{"id":611},"options","Options",[614,615,616,622,632,643,650,657],"field-group",{},[617,618],"field",{"name":619,"type":620,"default":621},"enabled","boolean","false",[617,623,625],{"name":398,"type":624},"Record\u003Cstring, string>",[189,626,627,628,631],{},"The apps allowed to ask, by ",[226,629,630],{},"client_id",", with the name the page shows for each.",[617,633,637],{"name":634,"type":635,"default":636},"page","string","'\u002Fdevice'",[189,638,639,640,477],{},"The approval page's path, which Better Auth gives devices as ",[226,641,642],{},"verification_uri",[617,644,647],{"name":645,"type":635,"default":646},"expiresIn","'30m'",[189,648,649],{},"How long a code lasts.",[617,651,654],{"name":652,"type":635,"default":653},"interval","'5s'",[189,655,656],{},"How often devices may check whether they're approved.",[617,658,662],{"name":659,"type":660,"default":661},"userCodeLength","number","8",[189,663,664],{},"Characters in the code people type.",[666,667,668],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":224,"searchDepth":232,"depth":254,"links":670},[671,672,673,674],{"id":206,"depth":254,"text":207},{"id":402,"depth":254,"text":403},{"id":439,"depth":254,"text":440},{"id":611,"depth":254,"text":612},"Sign in TVs, consoles, CLIs and desktop apps with a code.","md",null,{},{"icon":72},{"title":69,"description":675},"V1NtyhNh5bHweFYOsXTFLa2UNzwIAYxsxgS7I-4tqVw",[683,685],{"title":64,"path":65,"stem":66,"description":684,"icon":67,"children":-1},"Sign in with a code by text, sent through your own SMS provider.",{"title":74,"path":75,"stem":76,"description":686,"icon":77,"children":-1},"Captcha, breached-password checks, and emails about sensitive changes.",1793019844436]