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