[{"data":1,"prerenderedAt":331,"buildId":332},["ShallowReactive",2],{"docs-navigation-en":3,"examples-en":50,"page-\u002Fdocs\u002Fmigration":237,"surround-\u002Fdocs\u002Fmigration":326},[4],{"title":5,"path":6,"stem":7,"children":8,"page":49},"Docs","\u002Fdocs","docs",[9,13,17,21,25,29,33,37,41,45],{"title":10,"path":11,"stem":12},"Getting started","\u002Fdocs\u002Fgetting-started","docs\u002F01.getting-started",{"title":14,"path":15,"stem":16},"verifyUser","\u002Fdocs\u002Fverify-user","docs\u002F02.verify-user",{"title":18,"path":19,"stem":20},"Sites without users","\u002Fdocs\u002Fsites-without-users","docs\u002F03.sites-without-users",{"title":22,"path":23,"stem":24},"Build-time route check","\u002Fdocs\u002Froute-coverage","docs\u002F04.route-coverage",{"title":26,"path":27,"stem":28},"Public routes","\u002Fdocs\u002Fpublic-routes","docs\u002F05.public-routes",{"title":30,"path":31,"stem":32},"Same-origin writes","\u002Fdocs\u002Fsame-origin","docs\u002F06.same-origin",{"title":34,"path":35,"stem":36},"Scope and caching","\u002Fdocs\u002Fscope","docs\u002F07.scope",{"title":38,"path":39,"stem":40},"Configuration","\u002Fdocs\u002Fconfiguration","docs\u002F08.configuration",{"title":42,"path":43,"stem":44},"Migrating an existing BFF guard","\u002Fdocs\u002Fmigration","docs\u002F09.migration",{"title":46,"path":47,"stem":48},"Contributing","\u002Fdocs\u002Fcontributing","docs\u002F10.contributing",false,[51,61,69,77,83,90,98,106,113,122,131,138,146,153,159,166,174,180,188,194,202,208,215,221,229],{"path":52,"title":53,"description":54,"category":55,"order":56,"uses":57},"\u002Fexamples\u002Fcontact-form","Contact form on a corporate site","A mail-sending route that only your own pages can call, with a bot check and a rate limit.","visitor",1,[58,59,60],"access: 'visitor'","@nuxtjs\u002Fturnstile","nuxt-security",{"path":62,"title":63,"description":64,"category":55,"order":65,"uses":66},"\u002Fexamples\u002Fpaid-api-proxy","Search box that calls a paid API","Keep other sites and scripts from spending your API quota through your BFF.",2,[58,67,68],"rateLimiter","defineCachedFunction",{"path":70,"title":71,"description":72,"category":55,"order":73,"uses":74},"\u002Fexamples\u002Fclient-data","JSON for client-side pages","Data that your pages fetch in the browser, kept from being embedded by other sites.",3,[58,75,76],"access: 'public'","useFetch",{"path":78,"title":79,"description":80,"category":55,"order":81,"uses":82},"\u002Fexamples\u002Fmember-site-contact","Visitor routes inside a member app","Keep 'user' as the default and open a few routes to visitors without accounts.",4,[58,14],{"path":84,"title":85,"description":86,"category":87,"order":56,"uses":88},"\u002Fexamples\u002Fnuxt-auth-utils","nuxt-auth-utils","Use the sealed Cookie session of nuxt-auth-utils as the user check.","auth",[85,89],"requireUserSession",{"path":91,"title":92,"description":93,"category":87,"order":65,"uses":94},"\u002Fexamples\u002Fsidebase-nuxt-auth","Auth.js with @sidebase\u002Fnuxt-auth","Check the Auth.js session, and accept the same JWT as a Bearer token.",[95,96,97],"@sidebase\u002Fnuxt-auth","getServerSession","getToken",{"path":99,"title":100,"description":101,"category":87,"order":73,"uses":102},"\u002Fexamples\u002Fsupabase","Supabase","Verify the Supabase session with getClaims, and tell bad tokens from outages.",[103,104,105],"@nuxtjs\u002Fsupabase","getClaims","isAuthRetryableFetchError",{"path":107,"title":108,"description":109,"category":87,"order":81,"uses":110},"\u002Fexamples\u002Fclerk","Clerk","Read the auth object that Clerk's middleware put on the event.",[111,112],"@clerk\u002Fnuxt","event.context.auth",{"path":114,"title":115,"description":116,"category":87,"order":117,"uses":118},"\u002Fexamples\u002Ffirebase","Firebase Authentication","Session Cookies for the browser, ID tokens for apps, and error codes mapped to 401 or 503.",5,[119,120,121],"firebase-admin","verifySessionCookie","verifyIdToken",{"path":123,"title":124,"description":125,"category":87,"order":126,"uses":127},"\u002Fexamples\u002Fjwt-jose","Any OpenID Connect provider (JWT)","Verify access tokens from Auth0, Keycloak, Cognito, Entra ID and others with jose.",6,[128,129,130],"jose","jwtVerify","createRemoteJWKSet",{"path":132,"title":133,"description":134,"category":135,"order":56,"uses":136},"\u002Fexamples\u002Fnuxt-security-rate-limit","Rate limits with nuxt-security","Slow down credential stuffing and token guessing before verifyUser runs.","security",[60,67,137],"routeRules",{"path":139,"title":140,"description":141,"category":135,"order":65,"uses":142},"\u002Fexamples\u002Fnuxt-security-headers","Headers, CSP and request limits with nuxt-security","A baseline nuxt-security setup next to the guard, tuned for a BFF.",[60,143,144,145],"headers","requestSizeLimiter","allowedMethodsRestricter",{"path":147,"title":148,"description":149,"category":135,"order":73,"uses":150},"\u002Fexamples\u002Fnuxt-csurf","CSRF tokens with nuxt-csurf","Add a synchronizer token on top of the origin check, without breaking Bearer clients.",[151,152,137],"nuxt-csurf","useCsrfFetch",{"path":154,"title":155,"description":156,"category":135,"order":81,"uses":157},"\u002Fexamples\u002Fturnstile","Bot checks on public routes with Turnstile","Public sign-in and sign-up routes skip verifyUser, so give them their own check.",[59,158],"verifyTurnstileToken",{"path":160,"title":161,"description":162,"category":135,"order":117,"uses":163},"\u002Fexamples\u002Fcors-bearer-clients","A frontend on another origin","CORS with nuxt-security for a separate app that calls the BFF with Bearer tokens.",[60,164,165],"corsHandler","viaBearer",{"path":167,"title":168,"description":169,"category":170,"order":56,"uses":171},"\u002Fexamples\u002Frecord-authorization","Per-record authorization","The guard says who the user is. The handler decides what they may touch.","patterns",[172,173],"event.context","createError",{"path":175,"title":176,"description":177,"category":170,"order":65,"uses":178},"\u002Fexamples\u002Froles","Roles and app-wide access","Reject whole groups of users in verifyUser, and check roles per route.",[14,179],"403",{"path":181,"title":182,"description":183,"category":170,"order":73,"uses":184},"\u002Fexamples\u002Fupstream-proxy","Calling an upstream API","Attach the user's token after the guard, never in middleware or routeRules.proxy.",[185,186,187],"$fetch","routeRules.proxy","server\u002Futils",{"path":189,"title":190,"description":191,"category":170,"order":81,"uses":192},"\u002Fexamples\u002Fssr-and-server-functions","SSR and server functions","Call your own API during server rendering, or skip HTTP entirely.",[76,193,187],"useRequestFetch",{"path":195,"title":196,"description":197,"category":170,"order":117,"uses":198},"\u002Fexamples\u002Fwebhooks","Webhooks","Server-to-server callbacks belong outside server\u002Fapi, with their own signature check.",[199,200,201],"server\u002Froutes","readRawBody","xssValidator",{"path":203,"title":204,"description":205,"category":170,"order":126,"uses":206},"\u002Fexamples\u002Fbearer-clients","Mobile apps and CLI tools","One BFF for the browser and for clients that send Bearer tokens.",[165,207],"Authorization",{"path":209,"title":210,"description":211,"category":170,"order":212,"uses":213},"\u002Fexamples\u002Fmore-route-folders","Checking more folders at build time","Extend routePatterns to server\u002Froutes and layers.",7,[214],"routePatterns",{"path":216,"title":217,"description":218,"category":170,"order":219,"uses":220},"\u002Fexamples\u002Fpublic-cache","Caching public data","Cache what is the same for everyone on a separate public route.",8,[68,75],{"path":222,"title":223,"description":224,"category":170,"order":225,"uses":226},"\u002Fexamples\u002Fclient-errors","Handling 401, 403 and 503 in the app","Sign out on 401, explain 403, retry on 503.",9,[227,228],"$fetch.create","onResponseError",{"path":230,"title":231,"description":232,"category":170,"order":233,"uses":234},"\u002Fexamples\u002Ftesting","Testing the protection","An end-to-end test that every protected route refuses anonymous calls.",10,[235,236],"@nuxt\u002Ftest-utils","vitest",{"id":238,"title":42,"body":239,"description":320,"extension":321,"meta":322,"navigation":323,"path":43,"seo":324,"stem":44,"__hash__":325},"docs_en\u002Fdocs\u002F09.migration.md",{"type":240,"value":241,"toc":317},"minimark",[242],[243,244,245,257,271,280,290,311],"ol",{},[246,247,248,256],"li",{},[249,250,251,252,255],"strong",{},"Move the identity check into ",[253,254,14],"code",{},"."," Bring the Cookie name, the token checks and the app-wide 403 rule with it.",[246,258,259,262,263,266,267,270],{},[249,260,261],{},"Wrap each protected route."," Replace ",[253,264,265],{},"defineEventHandler"," with ",[253,268,269],{},"defineBffHandler",". If a middleware attached credentials or forwarded requests upstream, move that into a function the handler calls after the guard.",[246,272,273,276,277,255],{},[249,274,275],{},"Find the public routes."," Walk through sign-in, sign-out and token refresh with no Cookie, a deleted Cookie and an expired one. Mark the routes those states need with ",[253,278,279],{},"{ access: 'public' }",[246,281,282,285,286,289],{},[249,283,284],{},"Replace internal HTTP calls."," Routes that only your server called become server functions in ",[253,287,288],{},"server\u002Futils\u002F",", called directly.",[246,291,292,295,296,299,300,303,304,307,308,310],{},[249,293,294],{},"Remove old options."," ",[253,297,298],{},"apiPrefix",", ",[253,301,302],{},"publicPaths"," and ",[253,305,306],{},"internalRequests"," from older versions stop the startup with an error, so nothing is dropped silently. Remove any internal request marker and any replaced global ",[253,309,185],{}," as well.",[246,312,313,316],{},[249,314,315],{},"Verify."," Call the BFF without credentials and expect 401 from every protected route. Then check the public routes, sign-in from a fresh browser profile, sign-out, and token refresh.",{"title":318,"searchDepth":65,"depth":65,"links":319},"",[],"Move from a global middleware or an older version to defineBffHandler.","md",{},true,{"title":42,"description":320},"TMKDlku88J81uj5XBaxolBTIPIieSA-Qsw7LeAqGylg",[327,329],{"title":38,"path":39,"stem":40,"description":328,"children":-1},"All options of the bffGuard key.",{"title":46,"path":47,"stem":48,"description":330,"children":-1},"Verify a change locally, and what to include in a report.",1796451485380,"a99f93bd-e267-45a7-90df-9194cd77468d"]