[{"data":1,"prerenderedAt":513},["ShallowReactive",2],{"navigation":3,"\u002Fguides\u002Ftwo-factor":203,"\u002Fguides\u002Ftwo-factor-surround":508},[4,33,96,114,177],{"title":5,"path":6,"stem":7,"children":8,"icon":32},"Get started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,12,17,22,27],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-house",{"title":13,"path":14,"stem":15,"icon":16},"Install AuthEndpoints","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-play",{"title":23,"path":24,"stem":25,"icon":26},"Choose a sign-in stack","\u002Fgetting-started\u002Fchoose-a-sign-in-stack","1.getting-started\u002F4.choose-a-sign-in-stack","i-lucide-signpost",{"title":28,"path":29,"stem":30,"icon":31},"Use the AuthEndpoints skill with coding agents","\u002Fgetting-started\u002Fai-agents","1.getting-started\u002F5.ai-agents","i-lucide-bot","i-lucide-rocket",{"title":34,"path":35,"stem":36,"children":37,"icon":95},"Guides","\u002Fguides","2.guides\u002F01.index",[38,40,45,50,55,60,65,70,75,80,85,90],{"title":34,"path":35,"stem":36,"icon":39},"i-lucide-list-checks",{"title":41,"path":42,"stem":43,"icon":44},"Register users","\u002Fguides\u002Fregistration","2.guides\u002F02.registration","i-lucide-user-plus",{"title":46,"path":47,"stem":48,"icon":49},"Sign users in","\u002Fguides\u002Fsign-in","2.guides\u002F03.sign-in","i-lucide-log-in",{"title":51,"path":52,"stem":53,"icon":54},"Sign users out","\u002Fguides\u002Fsign-out","2.guides\u002F04.sign-out","i-lucide-log-out",{"title":56,"path":57,"stem":58,"icon":59},"Turn on two-factor authentication","\u002Fguides\u002Ftwo-factor","2.guides\u002F05.two-factor","i-lucide-smartphone",{"title":61,"path":62,"stem":63,"icon":64},"Reset a forgotten password","\u002Fguides\u002Freset-password","2.guides\u002F06.reset-password","i-lucide-key-round",{"title":66,"path":67,"stem":68,"icon":69},"Change a user's email or password","\u002Fguides\u002Fmanage-account","2.guides\u002F07.manage-account","i-lucide-user-cog",{"title":71,"path":72,"stem":73,"icon":74},"Add, rename, and remove passkeys","\u002Fguides\u002Fmanage-passkeys","2.guides\u002F08.manage-passkeys","i-lucide-scan-face",{"title":76,"path":77,"stem":78,"icon":79},"Link and unlink GitHub or Google accounts","\u002Fguides\u002Flink-external-accounts","2.guides\u002F09.link-external-accounts","i-lucide-link",{"title":81,"path":82,"stem":83,"icon":84},"Require step-up before sensitive actions","\u002Fguides\u002Fstep-up","2.guides\u002F10.step-up","i-lucide-shield-check",{"title":86,"path":87,"stem":88,"icon":89},"Call the API from a browser","\u002Fguides\u002Fbrowser-clients","2.guides\u002F11.browser-clients","i-lucide-globe",{"title":91,"path":92,"stem":93,"icon":94},"Prepare for production","\u002Fguides\u002Fproduction","2.guides\u002F12.production","i-lucide-factory","i-lucide-waypoints",{"title":97,"path":98,"stem":99,"children":100,"icon":113},"Composable endpoints","\u002Fcomposables","3.composables\u002F1.index",[101,104,108],{"title":102,"path":98,"stem":99,"icon":103},"How composition works","i-lucide-layout-grid",{"title":105,"path":106,"stem":107,"icon":39},"Composition requirements","\u002Fcomposables\u002Frequirements","3.composables\u002F2.requirements",{"title":109,"path":110,"stem":111,"icon":112},"Compose a custom auth stack","\u002Fcomposables\u002Frecipes","3.composables\u002F3.recipes","i-lucide-book-marked","i-lucide-blocks",{"title":115,"icon":116,"path":117,"stem":118,"children":119,"page":176},"Reference","i-lucide-book-open","\u002Fmodules","4.modules",[120,125,129,134,139,144,148,153,157,162,166,171],{"title":121,"path":122,"stem":123,"icon":124},"Endpoint reference","\u002Fmodules\u002Fendpoints","4.modules\u002F01.endpoints","i-lucide-route",{"title":126,"path":127,"stem":128,"icon":69},"Identity management module","\u002Fmodules\u002Fidentity-management","4.modules\u002F02.identity-management",{"title":130,"path":131,"stem":132,"icon":133},"Cookie sign-in module","\u002Fmodules\u002Fcookie-auth","4.modules\u002F03.cookie-auth","i-lucide-cookie",{"title":135,"path":136,"stem":137,"icon":138},"Identity bearer sign-in module","\u002Fmodules\u002Fbearer-auth","4.modules\u002F04.bearer-auth","i-lucide-key",{"title":140,"path":141,"stem":142,"icon":143},"JWT module","\u002Fmodules\u002Fjwt","4.modules\u002F05.jwt","i-lucide-fingerprint",{"title":145,"path":146,"stem":147,"icon":74},"Passkeys module","\u002Fmodules\u002Fpasskeys","4.modules\u002F06.passkeys",{"title":149,"path":150,"stem":151,"icon":152},"ReAuth module","\u002Fmodules\u002Freauth","4.modules\u002F07.reauth","i-lucide-shield-alert",{"title":154,"path":155,"stem":156,"icon":49},"External OAuth packages","\u002Fmodules\u002Fexternal-oauth","4.modules\u002F08.external-oauth",{"title":158,"path":159,"stem":160,"icon":161},"Configuration options","\u002Fmodules\u002Fconfiguration","4.modules\u002F09.configuration","i-lucide-settings",{"title":163,"path":164,"stem":165,"icon":84},"Antiforgery (CSRF) rules","\u002Fmodules\u002Fcsrf","4.modules\u002F10.csrf",{"title":167,"path":168,"stem":169,"icon":170},"Responses and errors","\u002Fmodules\u002Ferrors","4.modules\u002F11.errors","i-lucide-circle-alert",{"title":172,"path":173,"stem":174,"icon":175},"Rate-limit policies","\u002Fmodules\u002Frate-limits","4.modules\u002F12.rate-limits","i-lucide-gauge",false,{"title":178,"icon":179,"path":180,"stem":181,"children":182,"page":176},"Concepts","i-lucide-lightbulb","\u002Fconcepts","5.concepts",[183,188,193,198],{"title":184,"path":185,"stem":186,"icon":187},"AuthEndpoints compared with other options","\u002Fconcepts\u002Fcompare","5.concepts\u002F1.compare","i-lucide-git-compare",{"title":189,"path":190,"stem":191,"icon":192},"Stock Identity endpoints vs AuthEndpoints","\u002Fconcepts\u002Fstock-identity-vs-authendpoints","5.concepts\u002F2.stock-identity-vs-authendpoints","i-lucide-columns-2",{"title":194,"path":195,"stem":196,"icon":197},"Security model","\u002Fconcepts\u002Fsecurity-model","5.concepts\u002F3.security-model","i-lucide-shield",{"title":199,"path":200,"stem":201,"icon":202},"FAQ","\u002Fconcepts\u002Ffaq","5.concepts\u002F4.faq","i-lucide-circle-help",{"id":204,"title":56,"body":205,"description":501,"extension":502,"links":503,"meta":504,"navigation":505,"path":57,"seo":506,"stem":58,"__hash__":507},"docs\u002F2.guides\u002F05.two-factor.md",{"type":206,"value":207,"toc":489},"minimark",[208,229,248,253,258,262,277,281,335,349,352,370,374,394,401,405,447,457,461,467,471],[209,210,211,212,216,217,220,221,224,225,228],"p",{},"Users manage authenticator (TOTP) two-factor authentication through ",[213,214,215],"code",{},"\u002Fidentity\u002Fmanage\u002F2fa",". ",[213,218,219],{},"POST"," requires a signed-in user, a CSRF token in the ",[213,222,223],{},"RequestVerificationToken"," header, and a fresh ReAuth proof. The body is Identity's ",[213,226,227],{},"TwoFactorRequest",".",[209,230,231,232,235,236,239,240,242,243,228],{},"The steps assume a cookie session. Send ",[213,233,234],{},"credentials: 'include'"," and get a CSRF token from ",[213,237,238],{},"GET \u002Fidentity\u002FcsrfToken"," before each ",[213,241,219],{},". To sign in after 2FA is on, see ",[244,245,247],"a",{"href":246},"\u002Fguides\u002Fsign-in#enter-a-two-factor-code-or-a-recovery-code","Enter a two-factor code or a recovery code",[249,250,252],"h2",{"id":251},"video","Video",[254,255],"youtube-embed",{"id":256,"title":257},"fY1w3ROcyrE","Two-factor authentication end-to-end",[249,259,261],{"id":260},"read-the-2fa-status","Read the 2FA status",[209,263,264,265,268,269,272,273,276],{},"Send ",[213,266,267],{},"GET \u002Fidentity\u002Fmanage\u002F2fa",". The response is ",[213,270,271],{},"{ \"isTwoFactorEnabled\": true }"," or ",[213,274,275],{},"false",". This route needs no CSRF token and no ReAuth.",[249,278,280],{"id":279},"turn-on-2fa","Turn on 2FA",[282,283,284,290,303,306,313,321],"ol",{},[285,286,287,288,228],"li",{},"Complete step-up. See ",[244,289,81],{"href":82},[285,291,264,292,295,296,299,300,228],{},[213,293,294],{},"POST \u002Fidentity\u002Fmanage\u002F2fa"," with the body ",[213,297,298],{},"{}",". If the user has no authenticator key, the response includes a new ",[213,301,302],{},"sharedKey",[285,304,305],{},"Show the shared key, or a QR code made from it, so that the user can add it to an authenticator app.",[285,307,308,309,312],{},"If the ReAuth proof expired, complete step-up again. The default lifetime is 5 minutes (",[213,310,311],{},"ReAuth.Lifetime",").",[285,314,264,315,317,318,228],{},[213,316,294],{}," with ",[213,319,320],{},"{ \"enable\": true, \"twoFactorCode\": \"\u003C6-digit code>\" }",[285,322,323,324,327,328,331,332,228],{},"On ",[213,325,326],{},"200",", show the ",[213,329,330],{},"recoveryCodes"," from the response. When the user has no recovery codes left, turning on 2FA issues 10 new codes. The response also has ",[213,333,334],{},"isTwoFactorEnabled: true",[209,336,337,338,341,342,345,346,228],{},"Do not send ",[213,339,340],{},"enable: true"," together with ",[213,343,344],{},"resetSharedKey: true",". That request returns a validation problem with the key ",[213,347,348],{},"CannotResetSharedKeyAndEnable",[209,350,351],{},"These validation problems can also come back from step 5:",[353,354,355,364],"ul",{},[285,356,357,360,361,228],{},[213,358,359],{},"RequiresTwoFactor",": the request had no ",[213,362,363],{},"twoFactorCode",[285,365,366,369],{},[213,367,368],{},"InvalidTwoFactorCode",": the code did not match the shared key.",[249,371,373],{"id":372},"turn-off-2fa","Turn off 2FA",[282,375,376,379,386],{},[285,377,378],{},"Complete step-up.",[285,380,264,381,317,383,228],{},[213,382,294],{},[213,384,385],{},"{ \"enable\": false }",[285,387,323,388,390,391,228],{},[213,389,326],{},", the response has ",[213,392,393],{},"isTwoFactorEnabled: false",[209,395,396,397,400],{},"To rotate the authenticator key, send ",[213,398,399],{},"{ \"resetSharedKey\": true }",". That request also turns 2FA off. Turn it on again with a code from the new key.",[249,402,404],{"id":403},"use-the-other-request-fields","Use the other request fields",[406,407,408,421],"table",{},[409,410,411],"thead",{},[412,413,414,418],"tr",{},[415,416,417],"th",{},"Field",[415,419,420],{},"Effect",[422,423,424,437],"tbody",{},[412,425,426,432],{},[427,428,429],"td",{},[213,430,431],{},"resetRecoveryCodes",[427,433,434,435,228],{},"Issues 10 new recovery codes and returns them in ",[213,436,330],{},[412,438,439,444],{},[427,440,441],{},[213,442,443],{},"forgetMachine",[427,445,446],{},"Clears the two-factor remember-client cookie.",[209,448,449,450,452,453,228],{},"A persistent cookie login with a valid authenticator code sets the remember-client cookie. Later password logins from that browser skip the 2FA challenge until the user sends ",[213,451,443],{}," or logs out. See ",[244,454,456],{"href":455},"\u002Fguides\u002Fsign-in#remembered-browsers","Remembered browsers",[249,458,460],{"id":459},"know-which-sign-ins-skip-2fa","Know which sign-ins skip 2FA",[209,462,463,464,228],{},"Passkey sign-in and GitHub or Google sign-in do not ask for a 2FA code, even when 2FA is on. See ",[244,465,194],{"href":466},"\u002Fconcepts\u002Fsecurity-model#two-factor-is-a-password-add-on",[249,468,470],{"id":469},"related","Related",[353,472,473,477,481,485],{},[285,474,475],{},[244,476,46],{"href":47},[285,478,479],{},[244,480,81],{"href":82},[285,482,483],{},[244,484,126],{"href":127},[285,486,487],{},[244,488,149],{"href":150},{"title":490,"searchDepth":491,"depth":492,"links":493},"",1,2,[494,495,496,497,498,499,500],{"id":251,"depth":492,"text":252},{"id":260,"depth":492,"text":261},{"id":279,"depth":492,"text":280},{"id":372,"depth":492,"text":373},{"id":403,"depth":492,"text":404},{"id":459,"depth":492,"text":460},{"id":469,"depth":492,"text":470},"Turn authenticator two-factor authentication on and off, and issue recovery codes.","md",null,{},{"icon":59},{"title":56,"description":501},"_cAqzPwU-WpVqsFGo-yvugzV4ByAilwYF2KEbnDOoo4",[509,511],{"title":51,"path":52,"stem":53,"description":510,"icon":54,"children":-1},"Sign users out of the cookie, Identity bearer, and JWT stacks.",{"title":61,"path":62,"stem":63,"description":512,"icon":64,"children":-1},"Request a reset mail, set a new password, then sign in.",1791096170219]