[{"data":1,"prerenderedAt":927,"buildId":928},["ShallowReactive",2],{"docs-navigation-en":3,"example-\u002Fexamples\u002Fwebhooks":50,"example-surround-\u002Fexamples\u002Fwebhooks":755,"examples-en":764},[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,{"id":51,"title":52,"body":53,"category":744,"description":745,"extension":746,"meta":747,"navigation":140,"order":181,"path":748,"seo":749,"stem":750,"uses":751,"__hash__":754},"examples_en\u002Fexamples\u002Fwebhooks.md","Webhooks",{"type":54,"value":55,"toc":740},"minimark",[56,73,85,516,527,532,546,615,619,626,640,643,736],[57,58,59,60,64,65,68,69,72],"p",{},"Webhooks come from another server, with no user, no Cookie, and no ",[61,62,63],"code",{},"Origin"," or ",[61,66,67],{},"Sec-Fetch-Site"," header. The guard's same-origin check applies to every POST it wraps, public or not, so a webhook under ",[61,70,71],{},"server\u002Fapi"," would always get 403.",[57,74,75,76,79,80,84],{},"Put webhooks in ",[61,77,78],{},"server\u002Froutes\u002F",", which the default ",[81,82,83],"a",{"href":23},"route check"," does not cover, and verify the sender's signature before doing anything.",[86,87,93],"pre",{"className":88,"code":89,"filename":90,"language":91,"meta":92,"style":92},"language-ts shiki shiki-themes material-theme-lighter github-light github-dark","import { createHmac, timingSafeEqual } from 'node:crypto'\n\nconst secret = process.env.PAYMENTS_WEBHOOK_SECRET!\n\nexport default defineEventHandler(async (event) => {\n  const body = await readRawBody(event, 'utf8') ?? ''\n  const signature = getHeader(event, 'x-signature') ?? ''\n  const expected = createHmac('sha256', secret).update(body).digest('hex')\n\n  const valid = signature.length === expected.length\n    && timingSafeEqual(Buffer.from(signature), Buffer.from(expected))\n  if (!valid) throw createError({ statusCode: 401 })\n\n  await handlePaymentEvent(JSON.parse(body))\n  return { received: true }\n})\n","server\u002Froutes\u002Fwebhooks\u002Fpayments.post.ts","ts","",[61,94,95,135,142,174,179,214,255,287,343,348,375,417,458,463,488,508],{"__ignoreMap":92},[96,97,100,104,108,112,115,118,121,124,128,132],"span",{"class":98,"line":99},"line",1,[96,101,103],{"class":102},"sVHd0","import",[96,105,107],{"class":106},"sP7_E"," {",[96,109,111],{"class":110},"su5hD"," createHmac",[96,113,114],{"class":106},",",[96,116,117],{"class":110}," timingSafeEqual",[96,119,120],{"class":106}," }",[96,122,123],{"class":102}," from",[96,125,127],{"class":126},"sjJ54"," '",[96,129,131],{"class":130},"s_sjI","node:crypto",[96,133,134],{"class":126},"'\n",[96,136,138],{"class":98,"line":137},2,[96,139,141],{"emptyLinePlaceholder":140},true,"\n",[96,143,145,149,153,157,160,163,166,168,171],{"class":98,"line":144},3,[96,146,148],{"class":147},"sbsja","const",[96,150,152],{"class":151},"s_hVV"," secret",[96,154,156],{"class":155},"smGrS"," =",[96,158,159],{"class":110}," process",[96,161,162],{"class":106},".",[96,164,165],{"class":110},"env",[96,167,162],{"class":106},[96,169,170],{"class":151},"PAYMENTS_WEBHOOK_SECRET",[96,172,173],{"class":155},"!\n",[96,175,177],{"class":98,"line":176},4,[96,178,141],{"emptyLinePlaceholder":140},[96,180,182,185,188,192,195,198,201,205,208,211],{"class":98,"line":181},5,[96,183,184],{"class":102},"export",[96,186,187],{"class":102}," default",[96,189,191],{"class":190},"sGLFI"," defineEventHandler",[96,193,194],{"class":110},"(",[96,196,197],{"class":147},"async",[96,199,200],{"class":106}," (",[96,202,204],{"class":203},"s99_P","event",[96,206,207],{"class":106},")",[96,209,210],{"class":147}," =>",[96,212,213],{"class":106}," {\n",[96,215,217,220,223,225,228,231,234,236,238,240,243,246,249,252],{"class":98,"line":216},6,[96,218,219],{"class":147},"  const",[96,221,222],{"class":151}," body",[96,224,156],{"class":155},[96,226,227],{"class":102}," await",[96,229,230],{"class":190}," readRawBody",[96,232,194],{"class":233},"skxfh",[96,235,204],{"class":110},[96,237,114],{"class":106},[96,239,127],{"class":126},[96,241,242],{"class":130},"utf8",[96,244,245],{"class":126},"'",[96,247,248],{"class":233},") ",[96,250,251],{"class":155},"??",[96,253,254],{"class":126}," ''\n",[96,256,258,260,263,265,268,270,272,274,276,279,281,283,285],{"class":98,"line":257},7,[96,259,219],{"class":147},[96,261,262],{"class":151}," signature",[96,264,156],{"class":155},[96,266,267],{"class":190}," getHeader",[96,269,194],{"class":233},[96,271,204],{"class":110},[96,273,114],{"class":106},[96,275,127],{"class":126},[96,277,278],{"class":130},"x-signature",[96,280,245],{"class":126},[96,282,248],{"class":233},[96,284,251],{"class":155},[96,286,254],{"class":126},[96,288,290,292,295,297,299,301,303,306,308,310,312,314,316,319,321,324,326,328,331,333,335,338,340],{"class":98,"line":289},8,[96,291,219],{"class":147},[96,293,294],{"class":151}," expected",[96,296,156],{"class":155},[96,298,111],{"class":190},[96,300,194],{"class":233},[96,302,245],{"class":126},[96,304,305],{"class":130},"sha256",[96,307,245],{"class":126},[96,309,114],{"class":106},[96,311,152],{"class":110},[96,313,207],{"class":233},[96,315,162],{"class":106},[96,317,318],{"class":190},"update",[96,320,194],{"class":233},[96,322,323],{"class":110},"body",[96,325,207],{"class":233},[96,327,162],{"class":106},[96,329,330],{"class":190},"digest",[96,332,194],{"class":233},[96,334,245],{"class":126},[96,336,337],{"class":130},"hex",[96,339,245],{"class":126},[96,341,342],{"class":233},")\n",[96,344,346],{"class":98,"line":345},9,[96,347,141],{"emptyLinePlaceholder":140},[96,349,351,353,356,358,360,362,365,368,370,372],{"class":98,"line":350},10,[96,352,219],{"class":147},[96,354,355],{"class":151}," valid",[96,357,156],{"class":155},[96,359,262],{"class":110},[96,361,162],{"class":106},[96,363,364],{"class":151},"length",[96,366,367],{"class":155}," ===",[96,369,294],{"class":110},[96,371,162],{"class":106},[96,373,374],{"class":151},"length\n",[96,376,378,381,383,385,388,390,393,395,398,400,402,405,407,409,411,414],{"class":98,"line":377},11,[96,379,380],{"class":155},"    &&",[96,382,117],{"class":190},[96,384,194],{"class":233},[96,386,387],{"class":110},"Buffer",[96,389,162],{"class":106},[96,391,392],{"class":190},"from",[96,394,194],{"class":233},[96,396,397],{"class":110},"signature",[96,399,207],{"class":233},[96,401,114],{"class":106},[96,403,404],{"class":110}," Buffer",[96,406,162],{"class":106},[96,408,392],{"class":190},[96,410,194],{"class":233},[96,412,413],{"class":110},"expected",[96,415,416],{"class":233},"))\n",[96,418,420,423,425,428,431,433,436,439,441,444,447,450,454,456],{"class":98,"line":419},12,[96,421,422],{"class":102},"  if",[96,424,200],{"class":233},[96,426,427],{"class":155},"!",[96,429,430],{"class":110},"valid",[96,432,248],{"class":233},[96,434,435],{"class":102},"throw",[96,437,438],{"class":190}," createError",[96,440,194],{"class":233},[96,442,443],{"class":106},"{",[96,445,446],{"class":233}," statusCode",[96,448,449],{"class":106},":",[96,451,453],{"class":452},"srdBf"," 401",[96,455,120],{"class":106},[96,457,342],{"class":233},[96,459,461],{"class":98,"line":460},13,[96,462,141],{"emptyLinePlaceholder":140},[96,464,466,469,472,474,477,479,482,484,486],{"class":98,"line":465},14,[96,467,468],{"class":102},"  await",[96,470,471],{"class":190}," handlePaymentEvent",[96,473,194],{"class":233},[96,475,476],{"class":151},"JSON",[96,478,162],{"class":106},[96,480,481],{"class":190},"parse",[96,483,194],{"class":233},[96,485,323],{"class":110},[96,487,416],{"class":233},[96,489,491,494,496,499,501,505],{"class":98,"line":490},15,[96,492,493],{"class":102},"  return",[96,495,107],{"class":106},[96,497,498],{"class":233}," received",[96,500,449],{"class":106},[96,502,504],{"class":503},"syTEX"," true",[96,506,507],{"class":106}," }\n",[96,509,511,514],{"class":98,"line":510},16,[96,512,513],{"class":106},"}",[96,515,342],{"class":110},[57,517,518,519,522,523,526],{},"The route is served at ",[61,520,521],{},"\u002Fwebhooks\u002Fpayments",". Use the verification helper of your provider's SDK when it has one (Stripe's ",[61,524,525],{},"constructEvent",", for example); it also checks timestamps against replays.",[528,529,531],"h2",{"id":530},"keep-the-folder-small","Keep the folder small",[57,533,534,535,538,539,542,543,449],{},"Everything in ",[61,536,537],{},"server\u002Froutes\u002Fwebhooks\u002F"," is reachable without a user. Keep only signature-checked handlers there, and review additions to it as carefully as public routes. If you also check other folders with ",[61,540,541],{},"routePatterns",", list them explicitly instead of ",[61,544,545],{},"server\u002Froutes\u002F**",[86,547,550],{"className":88,"code":548,"filename":549,"language":91,"meta":92,"style":92},"bffGuard: {\n  verifyUser: '.\u002Fserver\u002Fauth\u002Fverify-user.ts',\n  routePatterns: ['server\u002Fapi\u002F**', 'server\u002Froutes\u002Faccount\u002F**'],\n}\n","nuxt.config.ts",[61,551,552,562,579,610],{"__ignoreMap":92},[96,553,554,558,560],{"class":98,"line":99},[96,555,557],{"class":556},"sbgvK","bffGuard",[96,559,449],{"class":106},[96,561,213],{"class":106},[96,563,564,567,569,571,574,576],{"class":98,"line":137},[96,565,566],{"class":556},"  verifyUser",[96,568,449],{"class":106},[96,570,127],{"class":126},[96,572,573],{"class":130},".\u002Fserver\u002Fauth\u002Fverify-user.ts",[96,575,245],{"class":126},[96,577,578],{"class":106},",\n",[96,580,581,584,586,589,591,594,596,598,600,603,605,608],{"class":98,"line":144},[96,582,583],{"class":556},"  routePatterns",[96,585,449],{"class":106},[96,587,588],{"class":233}," [",[96,590,245],{"class":126},[96,592,593],{"class":130},"server\u002Fapi\u002F**",[96,595,245],{"class":126},[96,597,114],{"class":106},[96,599,127],{"class":126},[96,601,602],{"class":130},"server\u002Froutes\u002Faccount\u002F**",[96,604,245],{"class":126},[96,606,607],{"class":233},"]",[96,609,578],{"class":106},[96,611,612],{"class":98,"line":176},[96,613,614],{"class":106},"}\n",[528,616,618],{"id":617},"security-middleware-on-the-same-path","Security middleware on the same path",[57,620,621,622,625],{},"Module middleware still runs for ",[61,623,624],{},"\u002Fwebhooks\u002F**",", before your handler. Two settings need care:",[627,628,629,637],"ul",{},[630,631,632,633,636],"li",{},"nuxt-security's ",[61,634,635],{},"xssValidator"," checks POST bodies by default and can reject payloads that contain HTML, such as an email body, with 400.",[630,638,639],{},"nuxt-csurf rejects requests without its token with 403.",[57,641,642],{},"Turn both off for webhooks, and keep the rate limiter and size limit:",[86,644,646],{"className":88,"code":645,"filename":549,"language":91,"meta":92,"style":92},"export default defineNuxtConfig({\n  routeRules: {\n    '\u002Fwebhooks\u002F**': {\n      security: { xssValidator: false },\n      csurf: false, \u002F\u002F only if you use nuxt-csurf\n    },\n  },\n})\n",[61,647,648,662,671,685,705,720,725,730],{"__ignoreMap":92},[96,649,650,652,654,657,659],{"class":98,"line":99},[96,651,184],{"class":102},[96,653,187],{"class":102},[96,655,656],{"class":190}," defineNuxtConfig",[96,658,194],{"class":110},[96,660,661],{"class":106},"{\n",[96,663,664,667,669],{"class":98,"line":137},[96,665,666],{"class":233},"  routeRules",[96,668,449],{"class":106},[96,670,213],{"class":106},[96,672,673,676,679,681,683],{"class":98,"line":144},[96,674,675],{"class":126},"    '",[96,677,624],{"class":678},"sZUrc",[96,680,245],{"class":126},[96,682,449],{"class":106},[96,684,213],{"class":106},[96,686,687,690,692,694,697,699,702],{"class":98,"line":176},[96,688,689],{"class":233},"      security",[96,691,449],{"class":106},[96,693,107],{"class":106},[96,695,696],{"class":233}," xssValidator",[96,698,449],{"class":106},[96,700,701],{"class":503}," false",[96,703,704],{"class":106}," },\n",[96,706,707,710,712,714,716],{"class":98,"line":181},[96,708,709],{"class":233},"      csurf",[96,711,449],{"class":106},[96,713,701],{"class":503},[96,715,114],{"class":106},[96,717,719],{"class":718},"sutJx"," \u002F\u002F only if you use nuxt-csurf\n",[96,721,722],{"class":98,"line":216},[96,723,724],{"class":106},"    },\n",[96,726,727],{"class":98,"line":257},[96,728,729],{"class":106},"  },\n",[96,731,732,734],{"class":98,"line":289},[96,733,513],{"class":106},[96,735,342],{"class":110},[737,738,739],"style",{},"html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s99_P, html code.shiki .s99_P{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#E36209;--shiki-default-font-style:inherit;--shiki-dark:#FFAB70;--shiki-dark-font-style:inherit}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .syTEX, html code.shiki .syTEX{--shiki-light:#FF5370;--shiki-default:#005CC5;--shiki-dark:#79B8FF}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 .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZUrc, html code.shiki .sZUrc{--shiki-light:#E53935;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}",{"title":92,"searchDepth":137,"depth":137,"links":741},[742,743],{"id":530,"depth":137,"text":531},{"id":617,"depth":137,"text":618},"patterns","Server-to-server callbacks belong outside server\u002Fapi, with their own signature check.","md",{},"\u002Fexamples\u002Fwebhooks",{"title":52,"description":745},"examples\u002Fwebhooks",[752,753,635],"server\u002Froutes","readRawBody","3CyD0jfJmkdtxpnLsnrd-1LdvZHMt23ox6nNsVfUqFM",[756,760],{"path":757,"title":758,"description":759,"category":744,"order":176},"\u002Fexamples\u002Fssr-and-server-functions","SSR and server functions","Call your own API during server rendering, or skip HTTP entirely.",{"path":761,"title":762,"description":763,"category":744,"order":216},"\u002Fexamples\u002Fbearer-clients","Mobile apps and CLI tools","One BFF for the browser and for clients that send Bearer tokens.",[765,774,781,788,793,800,808,816,823,831,839,846,854,861,867,874,881,887,895,898,900,903,908,913,920],{"path":766,"title":767,"description":768,"category":769,"order":99,"uses":770},"\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",[771,772,773],"access: 'visitor'","@nuxtjs\u002Fturnstile","nuxt-security",{"path":775,"title":776,"description":777,"category":769,"order":137,"uses":778},"\u002Fexamples\u002Fpaid-api-proxy","Search box that calls a paid API","Keep other sites and scripts from spending your API quota through your BFF.",[771,779,780],"rateLimiter","defineCachedFunction",{"path":782,"title":783,"description":784,"category":769,"order":144,"uses":785},"\u002Fexamples\u002Fclient-data","JSON for client-side pages","Data that your pages fetch in the browser, kept from being embedded by other sites.",[771,786,787],"access: 'public'","useFetch",{"path":789,"title":790,"description":791,"category":769,"order":176,"uses":792},"\u002Fexamples\u002Fmember-site-contact","Visitor routes inside a member app","Keep 'user' as the default and open a few routes to visitors without accounts.",[771,14],{"path":794,"title":795,"description":796,"category":797,"order":99,"uses":798},"\u002Fexamples\u002Fnuxt-auth-utils","nuxt-auth-utils","Use the sealed Cookie session of nuxt-auth-utils as the user check.","auth",[795,799],"requireUserSession",{"path":801,"title":802,"description":803,"category":797,"order":137,"uses":804},"\u002Fexamples\u002Fsidebase-nuxt-auth","Auth.js with @sidebase\u002Fnuxt-auth","Check the Auth.js session, and accept the same JWT as a Bearer token.",[805,806,807],"@sidebase\u002Fnuxt-auth","getServerSession","getToken",{"path":809,"title":810,"description":811,"category":797,"order":144,"uses":812},"\u002Fexamples\u002Fsupabase","Supabase","Verify the Supabase session with getClaims, and tell bad tokens from outages.",[813,814,815],"@nuxtjs\u002Fsupabase","getClaims","isAuthRetryableFetchError",{"path":817,"title":818,"description":819,"category":797,"order":176,"uses":820},"\u002Fexamples\u002Fclerk","Clerk","Read the auth object that Clerk's middleware put on the event.",[821,822],"@clerk\u002Fnuxt","event.context.auth",{"path":824,"title":825,"description":826,"category":797,"order":181,"uses":827},"\u002Fexamples\u002Ffirebase","Firebase Authentication","Session Cookies for the browser, ID tokens for apps, and error codes mapped to 401 or 503.",[828,829,830],"firebase-admin","verifySessionCookie","verifyIdToken",{"path":832,"title":833,"description":834,"category":797,"order":216,"uses":835},"\u002Fexamples\u002Fjwt-jose","Any OpenID Connect provider (JWT)","Verify access tokens from Auth0, Keycloak, Cognito, Entra ID and others with jose.",[836,837,838],"jose","jwtVerify","createRemoteJWKSet",{"path":840,"title":841,"description":842,"category":843,"order":99,"uses":844},"\u002Fexamples\u002Fnuxt-security-rate-limit","Rate limits with nuxt-security","Slow down credential stuffing and token guessing before verifyUser runs.","security",[773,779,845],"routeRules",{"path":847,"title":848,"description":849,"category":843,"order":137,"uses":850},"\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.",[773,851,852,853],"headers","requestSizeLimiter","allowedMethodsRestricter",{"path":855,"title":856,"description":857,"category":843,"order":144,"uses":858},"\u002Fexamples\u002Fnuxt-csurf","CSRF tokens with nuxt-csurf","Add a synchronizer token on top of the origin check, without breaking Bearer clients.",[859,860,845],"nuxt-csurf","useCsrfFetch",{"path":862,"title":863,"description":864,"category":843,"order":176,"uses":865},"\u002Fexamples\u002Fturnstile","Bot checks on public routes with Turnstile","Public sign-in and sign-up routes skip verifyUser, so give them their own check.",[772,866],"verifyTurnstileToken",{"path":868,"title":869,"description":870,"category":843,"order":181,"uses":871},"\u002Fexamples\u002Fcors-bearer-clients","A frontend on another origin","CORS with nuxt-security for a separate app that calls the BFF with Bearer tokens.",[773,872,873],"corsHandler","viaBearer",{"path":875,"title":876,"description":877,"category":744,"order":99,"uses":878},"\u002Fexamples\u002Frecord-authorization","Per-record authorization","The guard says who the user is. The handler decides what they may touch.",[879,880],"event.context","createError",{"path":882,"title":883,"description":884,"category":744,"order":137,"uses":885},"\u002Fexamples\u002Froles","Roles and app-wide access","Reject whole groups of users in verifyUser, and check roles per route.",[14,886],"403",{"path":888,"title":889,"description":890,"category":744,"order":144,"uses":891},"\u002Fexamples\u002Fupstream-proxy","Calling an upstream API","Attach the user's token after the guard, never in middleware or routeRules.proxy.",[892,893,894],"$fetch","routeRules.proxy","server\u002Futils",{"path":757,"title":758,"description":759,"category":744,"order":176,"uses":896},[787,897,894],"useRequestFetch",{"path":748,"title":52,"description":745,"category":744,"order":181,"uses":899},[752,753,635],{"path":761,"title":762,"description":763,"category":744,"order":216,"uses":901},[873,902],"Authorization",{"path":904,"title":905,"description":906,"category":744,"order":257,"uses":907},"\u002Fexamples\u002Fmore-route-folders","Checking more folders at build time","Extend routePatterns to server\u002Froutes and layers.",[541],{"path":909,"title":910,"description":911,"category":744,"order":289,"uses":912},"\u002Fexamples\u002Fpublic-cache","Caching public data","Cache what is the same for everyone on a separate public route.",[780,786],{"path":914,"title":915,"description":916,"category":744,"order":345,"uses":917},"\u002Fexamples\u002Fclient-errors","Handling 401, 403 and 503 in the app","Sign out on 401, explain 403, retry on 503.",[918,919],"$fetch.create","onResponseError",{"path":921,"title":922,"description":923,"category":744,"order":350,"uses":924},"\u002Fexamples\u002Ftesting","Testing the protection","An end-to-end test that every protected route refuses anonymous calls.",[925,926],"@nuxt\u002Ftest-utils","vitest",1796451484099,"a99f93bd-e267-45a7-90df-9194cd77468d"]