[{"data":1,"prerenderedAt":1137,"buildId":1138},["ShallowReactive",2],{"docs-navigation-en":3,"example-\u002Fexamples\u002Ftesting":50,"example-surround-\u002Fexamples\u002Ftesting":965,"examples-en":971},[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":955,"description":956,"extension":957,"meta":958,"navigation":180,"order":334,"path":959,"seo":960,"stem":961,"uses":962,"__hash__":964},"examples_en\u002Fexamples\u002Ftesting.md","Testing the protection",{"type":54,"value":55,"toc":953},"minimark",[56,68,874,880,943,949],[57,58,59,60,64,65,67],"p",{},"The build already fails when a route forgets ",[61,62,63],"code",{},"defineBffHandler",". A short end-to-end test checks the rest: that ",[61,66,14],{}," really rejects anonymous calls and that public routes stay public.",[69,70,76],"pre",{"className":71,"code":72,"filename":73,"language":74,"meta":75,"style":75},"language-ts shiki shiki-themes material-theme-lighter github-light github-dark","import { fileURLToPath } from 'node:url'\nimport { $fetch, fetch, setup } from '@nuxt\u002Ftest-utils\u002Fe2e'\nimport { describe, expect, test } from 'vitest'\n\nawait setup({ rootDir: fileURLToPath(new URL('..', import.meta.url)) })\n\nconst protectedRoutes = ['\u002Fapi\u002Forders', '\u002Fapi\u002Fme', '\u002Fapi\u002Finvoices']\nconst publicRoutes = ['\u002Fapi\u002Fhealth', '\u002Fapi\u002Fcatalog']\n\ndescribe('anonymous requests', () => {\n  test.each(protectedRoutes)('%s answers 401', async (path) => {\n    const response = await fetch(path)\n    expect(response.status).toBe(401)\n    expect(response.headers.get('cache-control')).toBe('private, no-store')\n  })\n\n  test.each(publicRoutes)('%s stays public', async (path) => {\n    expect((await fetch(path)).status).toBe(200)\n  })\n})\n\ntest('Cookie writes from another site are refused', async () => {\n  const response = await fetch('\u002Fapi\u002Forders', {\n    method: 'POST',\n    headers: { 'cookie': 'session=test-user', 'sec-fetch-site': 'cross-site' },\n  })\n  expect(response.status).toBe(403)\n})\n\ntest('a signed-in user gets data', async () => {\n  const orders = await $fetch('\u002Fapi\u002Forders', { headers: { cookie: 'session=test-user' } })\n  expect(orders).toBeInstanceOf(Array)\n})\n","test\u002Fbff.test.ts","ts","",[61,77,78,112,144,175,182,248,253,297,327,332,358,403,425,456,502,510,515,552,587,594,601,606,631,657,675,723,730,757,764,769,793,843,867],{"__ignoreMap":75},[79,80,83,87,91,95,98,101,105,109],"span",{"class":81,"line":82},"line",1,[79,84,86],{"class":85},"sVHd0","import",[79,88,90],{"class":89},"sP7_E"," {",[79,92,94],{"class":93},"su5hD"," fileURLToPath",[79,96,97],{"class":89}," }",[79,99,100],{"class":85}," from",[79,102,104],{"class":103},"sjJ54"," '",[79,106,108],{"class":107},"s_sjI","node:url",[79,110,111],{"class":103},"'\n",[79,113,115,117,119,122,125,128,130,133,135,137,139,142],{"class":81,"line":114},2,[79,116,86],{"class":85},[79,118,90],{"class":89},[79,120,121],{"class":93}," $fetch",[79,123,124],{"class":89},",",[79,126,127],{"class":93}," fetch",[79,129,124],{"class":89},[79,131,132],{"class":93}," setup",[79,134,97],{"class":89},[79,136,100],{"class":85},[79,138,104],{"class":103},[79,140,141],{"class":107},"@nuxt\u002Ftest-utils\u002Fe2e",[79,143,111],{"class":103},[79,145,147,149,151,154,156,159,161,164,166,168,170,173],{"class":81,"line":146},3,[79,148,86],{"class":85},[79,150,90],{"class":89},[79,152,153],{"class":93}," describe",[79,155,124],{"class":89},[79,157,158],{"class":93}," expect",[79,160,124],{"class":89},[79,162,163],{"class":93}," test",[79,165,97],{"class":89},[79,167,100],{"class":85},[79,169,104],{"class":103},[79,171,172],{"class":107},"vitest",[79,174,111],{"class":103},[79,176,178],{"class":81,"line":177},4,[79,179,181],{"emptyLinePlaceholder":180},true,"\n",[79,183,185,188,191,194,197,201,204,206,208,212,215,217,220,223,225,227,230,233,237,239,242,245],{"class":81,"line":184},5,[79,186,187],{"class":85},"await",[79,189,132],{"class":190},"sGLFI",[79,192,193],{"class":93},"(",[79,195,196],{"class":89},"{",[79,198,200],{"class":199},"skxfh"," rootDir",[79,202,203],{"class":89},":",[79,205,94],{"class":190},[79,207,193],{"class":93},[79,209,211],{"class":210},"smGrS","new",[79,213,214],{"class":190}," URL",[79,216,193],{"class":93},[79,218,219],{"class":103},"'",[79,221,222],{"class":107},"..",[79,224,219],{"class":103},[79,226,124],{"class":89},[79,228,229],{"class":85}," import",[79,231,232],{"class":89},".",[79,234,236],{"class":235},"s_hVV","meta",[79,238,232],{"class":89},[79,240,241],{"class":93},"url)) ",[79,243,244],{"class":89},"}",[79,246,247],{"class":93},")\n",[79,249,251],{"class":81,"line":250},6,[79,252,181],{"emptyLinePlaceholder":180},[79,254,256,260,263,266,269,271,274,276,278,280,283,285,287,289,292,294],{"class":81,"line":255},7,[79,257,259],{"class":258},"sbsja","const",[79,261,262],{"class":235}," protectedRoutes",[79,264,265],{"class":210}," =",[79,267,268],{"class":93}," [",[79,270,219],{"class":103},[79,272,273],{"class":107},"\u002Fapi\u002Forders",[79,275,219],{"class":103},[79,277,124],{"class":89},[79,279,104],{"class":103},[79,281,282],{"class":107},"\u002Fapi\u002Fme",[79,284,219],{"class":103},[79,286,124],{"class":89},[79,288,104],{"class":103},[79,290,291],{"class":107},"\u002Fapi\u002Finvoices",[79,293,219],{"class":103},[79,295,296],{"class":93},"]\n",[79,298,300,302,305,307,309,311,314,316,318,320,323,325],{"class":81,"line":299},8,[79,301,259],{"class":258},[79,303,304],{"class":235}," publicRoutes",[79,306,265],{"class":210},[79,308,268],{"class":93},[79,310,219],{"class":103},[79,312,313],{"class":107},"\u002Fapi\u002Fhealth",[79,315,219],{"class":103},[79,317,124],{"class":89},[79,319,104],{"class":103},[79,321,322],{"class":107},"\u002Fapi\u002Fcatalog",[79,324,219],{"class":103},[79,326,296],{"class":93},[79,328,330],{"class":81,"line":329},9,[79,331,181],{"emptyLinePlaceholder":180},[79,333,335,338,340,342,345,347,349,352,355],{"class":81,"line":334},10,[79,336,337],{"class":190},"describe",[79,339,193],{"class":93},[79,341,219],{"class":103},[79,343,344],{"class":107},"anonymous requests",[79,346,219],{"class":103},[79,348,124],{"class":89},[79,350,351],{"class":89}," ()",[79,353,354],{"class":258}," =>",[79,356,357],{"class":89}," {\n",[79,359,361,364,366,369,371,374,377,379,382,384,386,389,392,396,399,401],{"class":81,"line":360},11,[79,362,363],{"class":93},"  test",[79,365,232],{"class":89},[79,367,368],{"class":190},"each",[79,370,193],{"class":199},[79,372,373],{"class":93},"protectedRoutes",[79,375,376],{"class":199},")(",[79,378,219],{"class":103},[79,380,381],{"class":107},"%s answers 401",[79,383,219],{"class":103},[79,385,124],{"class":89},[79,387,388],{"class":258}," async",[79,390,391],{"class":89}," (",[79,393,395],{"class":394},"s99_P","path",[79,397,398],{"class":89},")",[79,400,354],{"class":258},[79,402,357],{"class":89},[79,404,406,409,412,414,417,419,421,423],{"class":81,"line":405},12,[79,407,408],{"class":258},"    const",[79,410,411],{"class":235}," response",[79,413,265],{"class":210},[79,415,416],{"class":85}," await",[79,418,127],{"class":190},[79,420,193],{"class":199},[79,422,395],{"class":93},[79,424,247],{"class":199},[79,426,428,431,433,436,438,441,443,445,448,450,454],{"class":81,"line":427},13,[79,429,430],{"class":190},"    expect",[79,432,193],{"class":199},[79,434,435],{"class":93},"response",[79,437,232],{"class":89},[79,439,440],{"class":93},"status",[79,442,398],{"class":199},[79,444,232],{"class":89},[79,446,447],{"class":190},"toBe",[79,449,193],{"class":199},[79,451,453],{"class":452},"srdBf","401",[79,455,247],{"class":199},[79,457,459,461,463,465,467,470,472,475,477,479,482,484,487,489,491,493,495,498,500],{"class":81,"line":458},14,[79,460,430],{"class":190},[79,462,193],{"class":199},[79,464,435],{"class":93},[79,466,232],{"class":89},[79,468,469],{"class":93},"headers",[79,471,232],{"class":89},[79,473,474],{"class":190},"get",[79,476,193],{"class":199},[79,478,219],{"class":103},[79,480,481],{"class":107},"cache-control",[79,483,219],{"class":103},[79,485,486],{"class":199},"))",[79,488,232],{"class":89},[79,490,447],{"class":190},[79,492,193],{"class":199},[79,494,219],{"class":103},[79,496,497],{"class":107},"private, no-store",[79,499,219],{"class":103},[79,501,247],{"class":199},[79,503,505,508],{"class":81,"line":504},15,[79,506,507],{"class":89},"  }",[79,509,247],{"class":199},[79,511,513],{"class":81,"line":512},16,[79,514,181],{"emptyLinePlaceholder":180},[79,516,518,520,522,524,526,529,531,533,536,538,540,542,544,546,548,550],{"class":81,"line":517},17,[79,519,363],{"class":93},[79,521,232],{"class":89},[79,523,368],{"class":190},[79,525,193],{"class":199},[79,527,528],{"class":93},"publicRoutes",[79,530,376],{"class":199},[79,532,219],{"class":103},[79,534,535],{"class":107},"%s stays public",[79,537,219],{"class":103},[79,539,124],{"class":89},[79,541,388],{"class":258},[79,543,391],{"class":89},[79,545,395],{"class":394},[79,547,398],{"class":89},[79,549,354],{"class":258},[79,551,357],{"class":89},[79,553,555,557,560,562,564,566,568,570,572,574,576,578,580,582,585],{"class":81,"line":554},18,[79,556,430],{"class":190},[79,558,559],{"class":199},"((",[79,561,187],{"class":85},[79,563,127],{"class":190},[79,565,193],{"class":199},[79,567,395],{"class":93},[79,569,486],{"class":199},[79,571,232],{"class":89},[79,573,440],{"class":93},[79,575,398],{"class":199},[79,577,232],{"class":89},[79,579,447],{"class":190},[79,581,193],{"class":199},[79,583,584],{"class":452},"200",[79,586,247],{"class":199},[79,588,590,592],{"class":81,"line":589},19,[79,591,507],{"class":89},[79,593,247],{"class":199},[79,595,597,599],{"class":81,"line":596},20,[79,598,244],{"class":89},[79,600,247],{"class":93},[79,602,604],{"class":81,"line":603},21,[79,605,181],{"emptyLinePlaceholder":180},[79,607,609,612,614,616,619,621,623,625,627,629],{"class":81,"line":608},22,[79,610,611],{"class":190},"test",[79,613,193],{"class":93},[79,615,219],{"class":103},[79,617,618],{"class":107},"Cookie writes from another site are refused",[79,620,219],{"class":103},[79,622,124],{"class":89},[79,624,388],{"class":258},[79,626,351],{"class":89},[79,628,354],{"class":258},[79,630,357],{"class":89},[79,632,634,637,639,641,643,645,647,649,651,653,655],{"class":81,"line":633},23,[79,635,636],{"class":258},"  const",[79,638,411],{"class":235},[79,640,265],{"class":210},[79,642,416],{"class":85},[79,644,127],{"class":190},[79,646,193],{"class":199},[79,648,219],{"class":103},[79,650,273],{"class":107},[79,652,219],{"class":103},[79,654,124],{"class":89},[79,656,357],{"class":89},[79,658,660,663,665,667,670,672],{"class":81,"line":659},24,[79,661,662],{"class":199},"    method",[79,664,203],{"class":89},[79,666,104],{"class":103},[79,668,669],{"class":107},"POST",[79,671,219],{"class":103},[79,673,674],{"class":89},",\n",[79,676,678,681,683,685,687,691,693,695,697,700,702,704,706,709,711,713,715,718,720],{"class":81,"line":677},25,[79,679,680],{"class":199},"    headers",[79,682,203],{"class":89},[79,684,90],{"class":89},[79,686,104],{"class":103},[79,688,690],{"class":689},"sZUrc","cookie",[79,692,219],{"class":103},[79,694,203],{"class":89},[79,696,104],{"class":103},[79,698,699],{"class":107},"session=test-user",[79,701,219],{"class":103},[79,703,124],{"class":89},[79,705,104],{"class":103},[79,707,708],{"class":689},"sec-fetch-site",[79,710,219],{"class":103},[79,712,203],{"class":89},[79,714,104],{"class":103},[79,716,717],{"class":107},"cross-site",[79,719,219],{"class":103},[79,721,722],{"class":89}," },\n",[79,724,726,728],{"class":81,"line":725},26,[79,727,507],{"class":89},[79,729,247],{"class":199},[79,731,733,736,738,740,742,744,746,748,750,752,755],{"class":81,"line":732},27,[79,734,735],{"class":190},"  expect",[79,737,193],{"class":199},[79,739,435],{"class":93},[79,741,232],{"class":89},[79,743,440],{"class":93},[79,745,398],{"class":199},[79,747,232],{"class":89},[79,749,447],{"class":190},[79,751,193],{"class":199},[79,753,754],{"class":452},"403",[79,756,247],{"class":199},[79,758,760,762],{"class":81,"line":759},28,[79,761,244],{"class":89},[79,763,247],{"class":93},[79,765,767],{"class":81,"line":766},29,[79,768,181],{"emptyLinePlaceholder":180},[79,770,772,774,776,778,781,783,785,787,789,791],{"class":81,"line":771},30,[79,773,611],{"class":190},[79,775,193],{"class":93},[79,777,219],{"class":103},[79,779,780],{"class":107},"a signed-in user gets data",[79,782,219],{"class":103},[79,784,124],{"class":89},[79,786,388],{"class":258},[79,788,351],{"class":89},[79,790,354],{"class":258},[79,792,357],{"class":89},[79,794,796,798,801,803,805,807,809,811,813,815,817,819,822,824,826,829,831,833,835,837,839,841],{"class":81,"line":795},31,[79,797,636],{"class":258},[79,799,800],{"class":235}," orders",[79,802,265],{"class":210},[79,804,416],{"class":85},[79,806,121],{"class":190},[79,808,193],{"class":199},[79,810,219],{"class":103},[79,812,273],{"class":107},[79,814,219],{"class":103},[79,816,124],{"class":89},[79,818,90],{"class":89},[79,820,821],{"class":199}," headers",[79,823,203],{"class":89},[79,825,90],{"class":89},[79,827,828],{"class":199}," cookie",[79,830,203],{"class":89},[79,832,104],{"class":103},[79,834,699],{"class":107},[79,836,219],{"class":103},[79,838,97],{"class":89},[79,840,97],{"class":89},[79,842,247],{"class":199},[79,844,846,848,850,853,855,857,860,862,865],{"class":81,"line":845},32,[79,847,735],{"class":190},[79,849,193],{"class":199},[79,851,852],{"class":93},"orders",[79,854,398],{"class":199},[79,856,232],{"class":89},[79,858,859],{"class":190},"toBeInstanceOf",[79,861,193],{"class":199},[79,863,864],{"class":93},"Array",[79,866,247],{"class":199},[79,868,870,872],{"class":81,"line":869},33,[79,871,244],{"class":89},[79,873,247],{"class":93},[57,875,876,877,879],{},"For the signed-in case, let a test-only ",[61,878,14],{}," accept a fixed Cookie. Point the option at it only in the test build:",[69,881,884],{"className":71,"code":882,"filename":883,"language":74,"meta":75,"style":75},"bffGuard: {\n  verifyUser: process.env.VITEST ? '.\u002Ftest\u002Fverify-user.ts' : '.\u002Fserver\u002Fauth\u002Fverify-user.ts',\n}\n","nuxt.config.ts",[61,885,886,896,938],{"__ignoreMap":75},[79,887,888,892,894],{"class":81,"line":82},[79,889,891],{"class":890},"sbgvK","bffGuard",[79,893,203],{"class":89},[79,895,357],{"class":89},[79,897,898,901,903,906,908,911,913,916,919,921,924,926,929,931,934,936],{"class":81,"line":114},[79,899,900],{"class":890},"  verifyUser",[79,902,203],{"class":89},[79,904,905],{"class":93}," process",[79,907,232],{"class":89},[79,909,910],{"class":93},"env",[79,912,232],{"class":89},[79,914,915],{"class":235},"VITEST",[79,917,918],{"class":210}," ?",[79,920,104],{"class":103},[79,922,923],{"class":107},".\u002Ftest\u002Fverify-user.ts",[79,925,219],{"class":103},[79,927,928],{"class":210}," :",[79,930,104],{"class":103},[79,932,933],{"class":107},".\u002Fserver\u002Fauth\u002Fverify-user.ts",[79,935,219],{"class":103},[79,937,674],{"class":89},[79,939,940],{"class":81,"line":146},[79,941,942],{"class":89},"}\n",[57,944,945,946,948],{},"Make sure ",[61,947,915],{}," is never set when you build for production, or use a separate Nuxt config for tests.",[950,951,952],"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 .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .skxfh, html code.shiki .skxfh{--shiki-light:#E53935;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--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 .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}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 .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZUrc, html code.shiki .sZUrc{--shiki-light:#E53935;--shiki-default:#032F62;--shiki-dark:#9ECBFF}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}",{"title":75,"searchDepth":114,"depth":114,"links":954},[],"patterns","An end-to-end test that every protected route refuses anonymous calls.","md",{},"\u002Fexamples\u002Ftesting",{"title":52,"description":956},"examples\u002Ftesting",[963,172],"@nuxt\u002Ftest-utils","smKNByQ_lOdatJQqbm78FLxCpUQIRj-gicHZ1qsWEAY",[966,970],{"path":967,"title":968,"description":969,"category":955,"order":329},"\u002Fexamples\u002Fclient-errors","Handling 401, 403 and 503 in the app","Sign out on 401, explain 403, retry on 503.",null,[972,981,988,995,1000,1007,1015,1023,1030,1038,1046,1053,1060,1067,1073,1080,1087,1092,1100,1106,1114,1120,1126,1131,1135],{"path":973,"title":974,"description":975,"category":976,"order":82,"uses":977},"\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",[978,979,980],"access: 'visitor'","@nuxtjs\u002Fturnstile","nuxt-security",{"path":982,"title":983,"description":984,"category":976,"order":114,"uses":985},"\u002Fexamples\u002Fpaid-api-proxy","Search box that calls a paid API","Keep other sites and scripts from spending your API quota through your BFF.",[978,986,987],"rateLimiter","defineCachedFunction",{"path":989,"title":990,"description":991,"category":976,"order":146,"uses":992},"\u002Fexamples\u002Fclient-data","JSON for client-side pages","Data that your pages fetch in the browser, kept from being embedded by other sites.",[978,993,994],"access: 'public'","useFetch",{"path":996,"title":997,"description":998,"category":976,"order":177,"uses":999},"\u002Fexamples\u002Fmember-site-contact","Visitor routes inside a member app","Keep 'user' as the default and open a few routes to visitors without accounts.",[978,14],{"path":1001,"title":1002,"description":1003,"category":1004,"order":82,"uses":1005},"\u002Fexamples\u002Fnuxt-auth-utils","nuxt-auth-utils","Use the sealed Cookie session of nuxt-auth-utils as the user check.","auth",[1002,1006],"requireUserSession",{"path":1008,"title":1009,"description":1010,"category":1004,"order":114,"uses":1011},"\u002Fexamples\u002Fsidebase-nuxt-auth","Auth.js with @sidebase\u002Fnuxt-auth","Check the Auth.js session, and accept the same JWT as a Bearer token.",[1012,1013,1014],"@sidebase\u002Fnuxt-auth","getServerSession","getToken",{"path":1016,"title":1017,"description":1018,"category":1004,"order":146,"uses":1019},"\u002Fexamples\u002Fsupabase","Supabase","Verify the Supabase session with getClaims, and tell bad tokens from outages.",[1020,1021,1022],"@nuxtjs\u002Fsupabase","getClaims","isAuthRetryableFetchError",{"path":1024,"title":1025,"description":1026,"category":1004,"order":177,"uses":1027},"\u002Fexamples\u002Fclerk","Clerk","Read the auth object that Clerk's middleware put on the event.",[1028,1029],"@clerk\u002Fnuxt","event.context.auth",{"path":1031,"title":1032,"description":1033,"category":1004,"order":184,"uses":1034},"\u002Fexamples\u002Ffirebase","Firebase Authentication","Session Cookies for the browser, ID tokens for apps, and error codes mapped to 401 or 503.",[1035,1036,1037],"firebase-admin","verifySessionCookie","verifyIdToken",{"path":1039,"title":1040,"description":1041,"category":1004,"order":250,"uses":1042},"\u002Fexamples\u002Fjwt-jose","Any OpenID Connect provider (JWT)","Verify access tokens from Auth0, Keycloak, Cognito, Entra ID and others with jose.",[1043,1044,1045],"jose","jwtVerify","createRemoteJWKSet",{"path":1047,"title":1048,"description":1049,"category":1050,"order":82,"uses":1051},"\u002Fexamples\u002Fnuxt-security-rate-limit","Rate limits with nuxt-security","Slow down credential stuffing and token guessing before verifyUser runs.","security",[980,986,1052],"routeRules",{"path":1054,"title":1055,"description":1056,"category":1050,"order":114,"uses":1057},"\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.",[980,469,1058,1059],"requestSizeLimiter","allowedMethodsRestricter",{"path":1061,"title":1062,"description":1063,"category":1050,"order":146,"uses":1064},"\u002Fexamples\u002Fnuxt-csurf","CSRF tokens with nuxt-csurf","Add a synchronizer token on top of the origin check, without breaking Bearer clients.",[1065,1066,1052],"nuxt-csurf","useCsrfFetch",{"path":1068,"title":1069,"description":1070,"category":1050,"order":177,"uses":1071},"\u002Fexamples\u002Fturnstile","Bot checks on public routes with Turnstile","Public sign-in and sign-up routes skip verifyUser, so give them their own check.",[979,1072],"verifyTurnstileToken",{"path":1074,"title":1075,"description":1076,"category":1050,"order":184,"uses":1077},"\u002Fexamples\u002Fcors-bearer-clients","A frontend on another origin","CORS with nuxt-security for a separate app that calls the BFF with Bearer tokens.",[980,1078,1079],"corsHandler","viaBearer",{"path":1081,"title":1082,"description":1083,"category":955,"order":82,"uses":1084},"\u002Fexamples\u002Frecord-authorization","Per-record authorization","The guard says who the user is. The handler decides what they may touch.",[1085,1086],"event.context","createError",{"path":1088,"title":1089,"description":1090,"category":955,"order":114,"uses":1091},"\u002Fexamples\u002Froles","Roles and app-wide access","Reject whole groups of users in verifyUser, and check roles per route.",[14,754],{"path":1093,"title":1094,"description":1095,"category":955,"order":146,"uses":1096},"\u002Fexamples\u002Fupstream-proxy","Calling an upstream API","Attach the user's token after the guard, never in middleware or routeRules.proxy.",[1097,1098,1099],"$fetch","routeRules.proxy","server\u002Futils",{"path":1101,"title":1102,"description":1103,"category":955,"order":177,"uses":1104},"\u002Fexamples\u002Fssr-and-server-functions","SSR and server functions","Call your own API during server rendering, or skip HTTP entirely.",[994,1105,1099],"useRequestFetch",{"path":1107,"title":1108,"description":1109,"category":955,"order":184,"uses":1110},"\u002Fexamples\u002Fwebhooks","Webhooks","Server-to-server callbacks belong outside server\u002Fapi, with their own signature check.",[1111,1112,1113],"server\u002Froutes","readRawBody","xssValidator",{"path":1115,"title":1116,"description":1117,"category":955,"order":250,"uses":1118},"\u002Fexamples\u002Fbearer-clients","Mobile apps and CLI tools","One BFF for the browser and for clients that send Bearer tokens.",[1079,1119],"Authorization",{"path":1121,"title":1122,"description":1123,"category":955,"order":255,"uses":1124},"\u002Fexamples\u002Fmore-route-folders","Checking more folders at build time","Extend routePatterns to server\u002Froutes and layers.",[1125],"routePatterns",{"path":1127,"title":1128,"description":1129,"category":955,"order":299,"uses":1130},"\u002Fexamples\u002Fpublic-cache","Caching public data","Cache what is the same for everyone on a separate public route.",[987,993],{"path":967,"title":968,"description":969,"category":955,"order":329,"uses":1132},[1133,1134],"$fetch.create","onResponseError",{"path":959,"title":52,"description":956,"category":955,"order":334,"uses":1136},[963,172],1796451484296,"a99f93bd-e267-45a7-90df-9194cd77468d"]