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