[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-encore-encore-auth":3,"mdc-mqnywr-key":34,"related-repo-encore-encore-auth":4839,"related-org-encore-encore-auth":4936},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":21,"repoUrl":22,"updatedAt":23,"license":24,"forks":25,"topics":26,"repo":29,"sourceUrl":32,"mdContent":33},"encore-auth","implement Encore.ts authentication","Protect Encore.ts endpoints with authentication and authorize callers. Covers `authHandler`, `Gateway`, `getAuthData`, and `auth: true`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"encore","Encore","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fencore.png","encoredev",[13,17,20],{"name":14,"slug":15,"type":16},"Auth","auth","tag",{"name":18,"slug":19,"type":16},"TypeScript","typescript",{"name":9,"slug":8,"type":16},26,"https:\u002F\u002Fgithub.com\u002Fencoredev\u002Fskills","2026-04-06T18:09:47.336322",null,5,[27,28],"claude-code","skills",{"repoUrl":22,"stars":21,"forks":25,"topics":30,"description":31},[27,28],"Agent Skills for development with Encore.","https:\u002F\u002Fgithub.com\u002Fencoredev\u002Fskills\u002Ftree\u002FHEAD\u002Fencore\u002Fauth","---\nname: encore-auth\ndescription: >-\n  Protect Encore.ts endpoints with authentication and authorize callers. Covers `authHandler`, `Gateway`, `getAuthData`, and `auth: true`.\nwhen_to_use: >-\n  User wants to require login on an endpoint, restrict an endpoint to authenticated\u002Fsigned-in users, validate a bearer token \u002F JWT \u002F API key from an Authorization header, read the current user inside a handler (`getAuthData`), set up an `authHandler\u003CAuthParams, AuthData>` or `Gateway`, return 401\u002F403 from a handler, or set `auth: true` on `api(...)`. Trigger phrases: \"protect this endpoint\", \"only authenticated users\", \"require login\", \"Authorization header\", \"bearer token\", \"401\", \"403\", \"who is calling\", \"current user\".\n---\n\n# Encore Authentication\n\n## Instructions\n\nEncore.ts provides a built-in authentication system for identifying API callers and protecting endpoints.\n\n### 1. Create an Auth Handler\n\n```typescript\n\u002F\u002F auth.ts\nimport { Header, Gateway } from \"encore.dev\u002Fapi\";\nimport { authHandler } from \"encore.dev\u002Fauth\";\n\n\u002F\u002F Define what the auth handler receives\ninterface AuthParams {\n  authorization: Header\u003C\"Authorization\">;\n}\n\n\u002F\u002F Define what authenticated requests will have access to\ninterface AuthData {\n  userID: string;\n  email: string;\n  role: \"admin\" | \"user\";\n}\n\nexport const auth = authHandler\u003CAuthParams, AuthData>(\n  async (params) => {\n    \u002F\u002F Validate the token (example with JWT)\n    const token = params.authorization.replace(\"Bearer \", \"\");\n    \n    const payload = await verifyToken(token);\n    if (!payload) {\n      throw APIError.unauthenticated(\"invalid token\");\n    }\n    \n    return {\n      userID: payload.sub,\n      email: payload.email,\n      role: payload.role,\n    };\n  }\n);\n\n\u002F\u002F Register the auth handler with a Gateway\nexport const gateway = new Gateway({\n  authHandler: auth,\n});\n```\n\n### 2. Protect Endpoints\n\n```typescript\nimport { api } from \"encore.dev\u002Fapi\";\n\n\u002F\u002F Protected endpoint - requires authentication\nexport const getProfile = api(\n  { method: \"GET\", path: \"\u002Fprofile\", expose: true, auth: true },\n  async (): Promise\u003CProfile> => {\n    \u002F\u002F Only authenticated users reach here\n  }\n);\n\n\u002F\u002F Public endpoint - no authentication required\nexport const healthCheck = api(\n  { method: \"GET\", path: \"\u002Fhealth\", expose: true },\n  async () => ({ status: \"ok\" })\n);\n```\n\n### 3. Access Auth Data in Endpoints\n\n```typescript\nimport { api } from \"encore.dev\u002Fapi\";\nimport { getAuthData } from \"~encore\u002Fauth\";\n\nexport const getProfile = api(\n  { method: \"GET\", path: \"\u002Fprofile\", expose: true, auth: true },\n  async (): Promise\u003CProfile> => {\n    const auth = getAuthData()!;  \u002F\u002F Non-null when auth: true\n    \n    return {\n      userID: auth.userID,\n      email: auth.email,\n      role: auth.role,\n    };\n  }\n);\n```\n\n## Auth Handler Behavior\n\n| Scenario | Handler Returns | Result |\n|----------|----------------|--------|\n| Valid credentials | `AuthData` object | Request authenticated |\n| Invalid credentials | Throws `APIError.unauthenticated()` | Treated as no auth |\n| Other error | Throws other error | Request aborted |\n\n## Auth with Endpoints\n\n| Endpoint Config | Request Has Auth | Result |\n|-----------------|------------------|--------|\n| `auth: true` | Yes | Proceeds with auth data |\n| `auth: true` | No | 401 Unauthenticated |\n| `auth: false` or omitted | Yes | Proceeds (auth data available) |\n| `auth: false` or omitted | No | Proceeds (no auth data) |\n\n## Service-to-Service Auth Propagation\n\nAuth data automatically propagates to internal service calls:\n\n```typescript\nimport { user } from \"~encore\u002Fclients\";\nimport { getAuthData } from \"~encore\u002Fauth\";\n\nexport const getOrderWithUser = api(\n  { method: \"GET\", path: \"\u002Forders\u002F:id\", expose: true, auth: true },\n  async ({ id }): Promise\u003COrderWithUser> => {\n    const auth = getAuthData()!;\n\n    \u002F\u002F Auth is automatically propagated to this call\n    const orderUser = await user.getProfile();\n\n    return { order: await getOrder(id), user: orderUser };\n  }\n);\n```\n\n### Overriding Auth Data\n\nYou can explicitly override auth data when making service-to-service calls:\n\n```typescript\nimport { user } from \"~encore\u002Fclients\";\n\n\u002F\u002F Override auth data for this specific call\nconst adminUser = await user.getProfile(\n  {},\n  { authData: { userID: \"admin-123\", email: \"admin@example.com\", role: \"admin\" } }\n);\n```\n\n## Common Auth Patterns\n\n### JWT Token Validation\n\n```typescript\nimport { jwtVerify } from \"jose\";\nimport { secret } from \"encore.dev\u002Fconfig\";\n\nconst jwtSecret = secret(\"JWTSecret\");\n\nasync function verifyToken(token: string): Promise\u003CJWTPayload | null> {\n  try {\n    const { payload } = await jwtVerify(\n      token,\n      new TextEncoder().encode(jwtSecret())\n    );\n    return payload;\n  } catch {\n    return null;\n  }\n}\n```\n\n### API Key Authentication\n\n```typescript\nexport const auth = authHandler\u003CAuthParams, AuthData>(\n  async (params) => {\n    const apiKey = params.authorization;\n    \n    const user = await db.queryRow\u003CUser>`\n      SELECT id, email, role FROM users WHERE api_key = ${apiKey}\n    `;\n    \n    if (!user) {\n      throw APIError.unauthenticated(\"invalid API key\");\n    }\n    \n    return {\n      userID: user.id,\n      email: user.email,\n      role: user.role,\n    };\n  }\n);\n```\n\n### Cookie-Based Auth\n\n```typescript\ninterface AuthParams {\n  cookie: Header\u003C\"Cookie\">;\n}\n\nexport const auth = authHandler\u003CAuthParams, AuthData>(\n  async (params) => {\n    const sessionId = parseCookie(params.cookie, \"session\");\n    \n    if (!sessionId) {\n      throw APIError.unauthenticated(\"no session\");\n    }\n    \n    const session = await getSession(sessionId);\n    if (!session || session.expiresAt \u003C new Date()) {\n      throw APIError.unauthenticated(\"session expired\");\n    }\n    \n    return {\n      userID: session.userID,\n      email: session.email,\n      role: session.role,\n    };\n  }\n);\n```\n\n## Testing with Auth\n\nMock authentication in tests using Vitest:\n\n```typescript\nimport { describe, it, expect, vi } from \"vitest\";\nimport * as auth from \"~encore\u002Fauth\";\nimport { getProfile } from \".\u002Fapi\";\n\ndescribe(\"authenticated endpoints\", () => {\n  it(\"returns profile for authenticated user\", async () => {\n    \u002F\u002F Mock getAuthData to return test user\n    const spy = vi.spyOn(auth, \"getAuthData\");\n    spy.mockImplementation(() => ({\n      userID: \"test-user-123\",\n      email: \"test@example.com\",\n      role: \"user\",\n    }));\n\n    const profile = await getProfile();\n    expect(profile.email).toBe(\"test@example.com\");\n\n    spy.mockRestore();\n  });\n});\n```\n\n## Guidelines\n\n- Auth handlers must be registered with a Gateway\n- Use `getAuthData()` from `~encore\u002Fauth` to access auth data\n- `getAuthData()` returns `null` in unauthenticated requests\n- Auth data propagates automatically in service-to-service calls\n- Throw `APIError.unauthenticated()` for invalid credentials\n- Keep auth handlers fast - they run on every authenticated request\n",{"data":35,"body":37},{"name":4,"description":6,"when_to_use":36},"User wants to require login on an endpoint, restrict an endpoint to authenticated\u002Fsigned-in users, validate a bearer token \u002F JWT \u002F API key from an Authorization header, read the current user inside a handler (`getAuthData`), set up an `authHandler\u003CAuthParams, AuthData>` or `Gateway`, return 401\u002F403 from a handler, or set `auth: true` on `api(...)`. Trigger phrases: \"protect this endpoint\", \"only authenticated users\", \"require login\", \"Authorization header\", \"bearer token\", \"401\", \"403\", \"who is calling\", \"current user\".",{"type":38,"children":39},"root",[40,49,56,62,69,983,989,1421,1427,1829,1835,1934,1940,2053,2059,2064,2493,2499,2504,2723,2729,2735,3120,3126,3540,3546,4125,4131,4136,4757,4763,4833],{"type":41,"tag":42,"props":43,"children":45},"element","h1",{"id":44},"encore-authentication",[46],{"type":47,"value":48},"text","Encore Authentication",{"type":41,"tag":50,"props":51,"children":53},"h2",{"id":52},"instructions",[54],{"type":47,"value":55},"Instructions",{"type":41,"tag":57,"props":58,"children":59},"p",{},[60],{"type":47,"value":61},"Encore.ts provides a built-in authentication system for identifying API callers and protecting endpoints.",{"type":41,"tag":63,"props":64,"children":66},"h3",{"id":65},"_1-create-an-auth-handler",[67],{"type":47,"value":68},"1. Create an Auth Handler",{"type":41,"tag":70,"props":71,"children":75},"pre",{"className":72,"code":73,"language":19,"meta":74,"style":74},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F auth.ts\nimport { Header, Gateway } from \"encore.dev\u002Fapi\";\nimport { authHandler } from \"encore.dev\u002Fauth\";\n\n\u002F\u002F Define what the auth handler receives\ninterface AuthParams {\n  authorization: Header\u003C\"Authorization\">;\n}\n\n\u002F\u002F Define what authenticated requests will have access to\ninterface AuthData {\n  userID: string;\n  email: string;\n  role: \"admin\" | \"user\";\n}\n\nexport const auth = authHandler\u003CAuthParams, AuthData>(\n  async (params) => {\n    \u002F\u002F Validate the token (example with JWT)\n    const token = params.authorization.replace(\"Bearer \", \"\");\n    \n    const payload = await verifyToken(token);\n    if (!payload) {\n      throw APIError.unauthenticated(\"invalid token\");\n    }\n    \n    return {\n      userID: payload.sub,\n      email: payload.email,\n      role: payload.role,\n    };\n  }\n);\n\n\u002F\u002F Register the auth handler with a Gateway\nexport const gateway = new Gateway({\n  authHandler: auth,\n});\n","",[76],{"type":41,"tag":77,"props":78,"children":79},"code",{"__ignoreMap":74},[80,92,155,197,207,215,236,278,287,295,304,321,343,364,412,420,428,484,518,527,605,614,658,691,739,748,755,768,799,829,859,868,877,889,897,906,944,966],{"type":41,"tag":81,"props":82,"children":85},"span",{"class":83,"line":84},"line",1,[86],{"type":41,"tag":81,"props":87,"children":89},{"style":88},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[90],{"type":47,"value":91},"\u002F\u002F auth.ts\n",{"type":41,"tag":81,"props":93,"children":95},{"class":83,"line":94},2,[96,102,108,114,119,124,129,134,139,145,150],{"type":41,"tag":81,"props":97,"children":99},{"style":98},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[100],{"type":47,"value":101},"import",{"type":41,"tag":81,"props":103,"children":105},{"style":104},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[106],{"type":47,"value":107}," {",{"type":41,"tag":81,"props":109,"children":111},{"style":110},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[112],{"type":47,"value":113}," Header",{"type":41,"tag":81,"props":115,"children":116},{"style":104},[117],{"type":47,"value":118},",",{"type":41,"tag":81,"props":120,"children":121},{"style":110},[122],{"type":47,"value":123}," Gateway",{"type":41,"tag":81,"props":125,"children":126},{"style":104},[127],{"type":47,"value":128}," }",{"type":41,"tag":81,"props":130,"children":131},{"style":98},[132],{"type":47,"value":133}," from",{"type":41,"tag":81,"props":135,"children":136},{"style":104},[137],{"type":47,"value":138}," \"",{"type":41,"tag":81,"props":140,"children":142},{"style":141},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[143],{"type":47,"value":144},"encore.dev\u002Fapi",{"type":41,"tag":81,"props":146,"children":147},{"style":104},[148],{"type":47,"value":149},"\"",{"type":41,"tag":81,"props":151,"children":152},{"style":104},[153],{"type":47,"value":154},";\n",{"type":41,"tag":81,"props":156,"children":158},{"class":83,"line":157},3,[159,163,167,172,176,180,184,189,193],{"type":41,"tag":81,"props":160,"children":161},{"style":98},[162],{"type":47,"value":101},{"type":41,"tag":81,"props":164,"children":165},{"style":104},[166],{"type":47,"value":107},{"type":41,"tag":81,"props":168,"children":169},{"style":110},[170],{"type":47,"value":171}," authHandler",{"type":41,"tag":81,"props":173,"children":174},{"style":104},[175],{"type":47,"value":128},{"type":41,"tag":81,"props":177,"children":178},{"style":98},[179],{"type":47,"value":133},{"type":41,"tag":81,"props":181,"children":182},{"style":104},[183],{"type":47,"value":138},{"type":41,"tag":81,"props":185,"children":186},{"style":141},[187],{"type":47,"value":188},"encore.dev\u002Fauth",{"type":41,"tag":81,"props":190,"children":191},{"style":104},[192],{"type":47,"value":149},{"type":41,"tag":81,"props":194,"children":195},{"style":104},[196],{"type":47,"value":154},{"type":41,"tag":81,"props":198,"children":200},{"class":83,"line":199},4,[201],{"type":41,"tag":81,"props":202,"children":204},{"emptyLinePlaceholder":203},true,[205],{"type":47,"value":206},"\n",{"type":41,"tag":81,"props":208,"children":209},{"class":83,"line":25},[210],{"type":41,"tag":81,"props":211,"children":212},{"style":88},[213],{"type":47,"value":214},"\u002F\u002F Define what the auth handler receives\n",{"type":41,"tag":81,"props":216,"children":218},{"class":83,"line":217},6,[219,225,231],{"type":41,"tag":81,"props":220,"children":222},{"style":221},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[223],{"type":47,"value":224},"interface",{"type":41,"tag":81,"props":226,"children":228},{"style":227},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[229],{"type":47,"value":230}," AuthParams",{"type":41,"tag":81,"props":232,"children":233},{"style":104},[234],{"type":47,"value":235}," {\n",{"type":41,"tag":81,"props":237,"children":239},{"class":83,"line":238},7,[240,246,251,255,260,264,269,273],{"type":41,"tag":81,"props":241,"children":243},{"style":242},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[244],{"type":47,"value":245},"  authorization",{"type":41,"tag":81,"props":247,"children":248},{"style":104},[249],{"type":47,"value":250},":",{"type":41,"tag":81,"props":252,"children":253},{"style":227},[254],{"type":47,"value":113},{"type":41,"tag":81,"props":256,"children":257},{"style":104},[258],{"type":47,"value":259},"\u003C",{"type":41,"tag":81,"props":261,"children":262},{"style":104},[263],{"type":47,"value":149},{"type":41,"tag":81,"props":265,"children":266},{"style":141},[267],{"type":47,"value":268},"Authorization",{"type":41,"tag":81,"props":270,"children":271},{"style":104},[272],{"type":47,"value":149},{"type":41,"tag":81,"props":274,"children":275},{"style":104},[276],{"type":47,"value":277},">;\n",{"type":41,"tag":81,"props":279,"children":281},{"class":83,"line":280},8,[282],{"type":41,"tag":81,"props":283,"children":284},{"style":104},[285],{"type":47,"value":286},"}\n",{"type":41,"tag":81,"props":288,"children":290},{"class":83,"line":289},9,[291],{"type":41,"tag":81,"props":292,"children":293},{"emptyLinePlaceholder":203},[294],{"type":47,"value":206},{"type":41,"tag":81,"props":296,"children":298},{"class":83,"line":297},10,[299],{"type":41,"tag":81,"props":300,"children":301},{"style":88},[302],{"type":47,"value":303},"\u002F\u002F Define what authenticated requests will have access to\n",{"type":41,"tag":81,"props":305,"children":307},{"class":83,"line":306},11,[308,312,317],{"type":41,"tag":81,"props":309,"children":310},{"style":221},[311],{"type":47,"value":224},{"type":41,"tag":81,"props":313,"children":314},{"style":227},[315],{"type":47,"value":316}," AuthData",{"type":41,"tag":81,"props":318,"children":319},{"style":104},[320],{"type":47,"value":235},{"type":41,"tag":81,"props":322,"children":324},{"class":83,"line":323},12,[325,330,334,339],{"type":41,"tag":81,"props":326,"children":327},{"style":242},[328],{"type":47,"value":329},"  userID",{"type":41,"tag":81,"props":331,"children":332},{"style":104},[333],{"type":47,"value":250},{"type":41,"tag":81,"props":335,"children":336},{"style":227},[337],{"type":47,"value":338}," string",{"type":41,"tag":81,"props":340,"children":341},{"style":104},[342],{"type":47,"value":154},{"type":41,"tag":81,"props":344,"children":346},{"class":83,"line":345},13,[347,352,356,360],{"type":41,"tag":81,"props":348,"children":349},{"style":242},[350],{"type":47,"value":351},"  email",{"type":41,"tag":81,"props":353,"children":354},{"style":104},[355],{"type":47,"value":250},{"type":41,"tag":81,"props":357,"children":358},{"style":227},[359],{"type":47,"value":338},{"type":41,"tag":81,"props":361,"children":362},{"style":104},[363],{"type":47,"value":154},{"type":41,"tag":81,"props":365,"children":367},{"class":83,"line":366},14,[368,373,377,381,386,390,395,399,404,408],{"type":41,"tag":81,"props":369,"children":370},{"style":242},[371],{"type":47,"value":372},"  role",{"type":41,"tag":81,"props":374,"children":375},{"style":104},[376],{"type":47,"value":250},{"type":41,"tag":81,"props":378,"children":379},{"style":104},[380],{"type":47,"value":138},{"type":41,"tag":81,"props":382,"children":383},{"style":141},[384],{"type":47,"value":385},"admin",{"type":41,"tag":81,"props":387,"children":388},{"style":104},[389],{"type":47,"value":149},{"type":41,"tag":81,"props":391,"children":392},{"style":104},[393],{"type":47,"value":394}," |",{"type":41,"tag":81,"props":396,"children":397},{"style":104},[398],{"type":47,"value":138},{"type":41,"tag":81,"props":400,"children":401},{"style":141},[402],{"type":47,"value":403},"user",{"type":41,"tag":81,"props":405,"children":406},{"style":104},[407],{"type":47,"value":149},{"type":41,"tag":81,"props":409,"children":410},{"style":104},[411],{"type":47,"value":154},{"type":41,"tag":81,"props":413,"children":415},{"class":83,"line":414},15,[416],{"type":41,"tag":81,"props":417,"children":418},{"style":104},[419],{"type":47,"value":286},{"type":41,"tag":81,"props":421,"children":423},{"class":83,"line":422},16,[424],{"type":41,"tag":81,"props":425,"children":426},{"emptyLinePlaceholder":203},[427],{"type":47,"value":206},{"type":41,"tag":81,"props":429,"children":431},{"class":83,"line":430},17,[432,437,442,447,452,457,461,466,470,474,479],{"type":41,"tag":81,"props":433,"children":434},{"style":98},[435],{"type":47,"value":436},"export",{"type":41,"tag":81,"props":438,"children":439},{"style":221},[440],{"type":47,"value":441}," const",{"type":41,"tag":81,"props":443,"children":444},{"style":110},[445],{"type":47,"value":446}," auth ",{"type":41,"tag":81,"props":448,"children":449},{"style":104},[450],{"type":47,"value":451},"=",{"type":41,"tag":81,"props":453,"children":455},{"style":454},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[456],{"type":47,"value":171},{"type":41,"tag":81,"props":458,"children":459},{"style":104},[460],{"type":47,"value":259},{"type":41,"tag":81,"props":462,"children":463},{"style":227},[464],{"type":47,"value":465},"AuthParams",{"type":41,"tag":81,"props":467,"children":468},{"style":104},[469],{"type":47,"value":118},{"type":41,"tag":81,"props":471,"children":472},{"style":227},[473],{"type":47,"value":316},{"type":41,"tag":81,"props":475,"children":476},{"style":104},[477],{"type":47,"value":478},">",{"type":41,"tag":81,"props":480,"children":481},{"style":110},[482],{"type":47,"value":483},"(\n",{"type":41,"tag":81,"props":485,"children":487},{"class":83,"line":486},18,[488,493,498,504,509,514],{"type":41,"tag":81,"props":489,"children":490},{"style":221},[491],{"type":47,"value":492},"  async",{"type":41,"tag":81,"props":494,"children":495},{"style":104},[496],{"type":47,"value":497}," (",{"type":41,"tag":81,"props":499,"children":501},{"style":500},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[502],{"type":47,"value":503},"params",{"type":41,"tag":81,"props":505,"children":506},{"style":104},[507],{"type":47,"value":508},")",{"type":41,"tag":81,"props":510,"children":511},{"style":221},[512],{"type":47,"value":513}," =>",{"type":41,"tag":81,"props":515,"children":516},{"style":104},[517],{"type":47,"value":235},{"type":41,"tag":81,"props":519,"children":521},{"class":83,"line":520},19,[522],{"type":41,"tag":81,"props":523,"children":524},{"style":88},[525],{"type":47,"value":526},"    \u002F\u002F Validate the token (example with JWT)\n",{"type":41,"tag":81,"props":528,"children":530},{"class":83,"line":529},20,[531,536,541,546,551,556,561,565,570,575,579,584,588,592,597,601],{"type":41,"tag":81,"props":532,"children":533},{"style":221},[534],{"type":47,"value":535},"    const",{"type":41,"tag":81,"props":537,"children":538},{"style":110},[539],{"type":47,"value":540}," token",{"type":41,"tag":81,"props":542,"children":543},{"style":104},[544],{"type":47,"value":545}," =",{"type":41,"tag":81,"props":547,"children":548},{"style":110},[549],{"type":47,"value":550}," params",{"type":41,"tag":81,"props":552,"children":553},{"style":104},[554],{"type":47,"value":555},".",{"type":41,"tag":81,"props":557,"children":558},{"style":110},[559],{"type":47,"value":560},"authorization",{"type":41,"tag":81,"props":562,"children":563},{"style":104},[564],{"type":47,"value":555},{"type":41,"tag":81,"props":566,"children":567},{"style":454},[568],{"type":47,"value":569},"replace",{"type":41,"tag":81,"props":571,"children":572},{"style":242},[573],{"type":47,"value":574},"(",{"type":41,"tag":81,"props":576,"children":577},{"style":104},[578],{"type":47,"value":149},{"type":41,"tag":81,"props":580,"children":581},{"style":141},[582],{"type":47,"value":583},"Bearer ",{"type":41,"tag":81,"props":585,"children":586},{"style":104},[587],{"type":47,"value":149},{"type":41,"tag":81,"props":589,"children":590},{"style":104},[591],{"type":47,"value":118},{"type":41,"tag":81,"props":593,"children":594},{"style":104},[595],{"type":47,"value":596}," \"\"",{"type":41,"tag":81,"props":598,"children":599},{"style":242},[600],{"type":47,"value":508},{"type":41,"tag":81,"props":602,"children":603},{"style":104},[604],{"type":47,"value":154},{"type":41,"tag":81,"props":606,"children":608},{"class":83,"line":607},21,[609],{"type":41,"tag":81,"props":610,"children":611},{"style":242},[612],{"type":47,"value":613},"    \n",{"type":41,"tag":81,"props":615,"children":617},{"class":83,"line":616},22,[618,622,627,631,636,641,645,650,654],{"type":41,"tag":81,"props":619,"children":620},{"style":221},[621],{"type":47,"value":535},{"type":41,"tag":81,"props":623,"children":624},{"style":110},[625],{"type":47,"value":626}," payload",{"type":41,"tag":81,"props":628,"children":629},{"style":104},[630],{"type":47,"value":545},{"type":41,"tag":81,"props":632,"children":633},{"style":98},[634],{"type":47,"value":635}," await",{"type":41,"tag":81,"props":637,"children":638},{"style":454},[639],{"type":47,"value":640}," verifyToken",{"type":41,"tag":81,"props":642,"children":643},{"style":242},[644],{"type":47,"value":574},{"type":41,"tag":81,"props":646,"children":647},{"style":110},[648],{"type":47,"value":649},"token",{"type":41,"tag":81,"props":651,"children":652},{"style":242},[653],{"type":47,"value":508},{"type":41,"tag":81,"props":655,"children":656},{"style":104},[657],{"type":47,"value":154},{"type":41,"tag":81,"props":659,"children":661},{"class":83,"line":660},23,[662,667,671,676,681,686],{"type":41,"tag":81,"props":663,"children":664},{"style":98},[665],{"type":47,"value":666},"    if",{"type":41,"tag":81,"props":668,"children":669},{"style":242},[670],{"type":47,"value":497},{"type":41,"tag":81,"props":672,"children":673},{"style":104},[674],{"type":47,"value":675},"!",{"type":41,"tag":81,"props":677,"children":678},{"style":110},[679],{"type":47,"value":680},"payload",{"type":41,"tag":81,"props":682,"children":683},{"style":242},[684],{"type":47,"value":685},") ",{"type":41,"tag":81,"props":687,"children":688},{"style":104},[689],{"type":47,"value":690},"{\n",{"type":41,"tag":81,"props":692,"children":694},{"class":83,"line":693},24,[695,700,705,709,714,718,722,727,731,735],{"type":41,"tag":81,"props":696,"children":697},{"style":98},[698],{"type":47,"value":699},"      throw",{"type":41,"tag":81,"props":701,"children":702},{"style":110},[703],{"type":47,"value":704}," APIError",{"type":41,"tag":81,"props":706,"children":707},{"style":104},[708],{"type":47,"value":555},{"type":41,"tag":81,"props":710,"children":711},{"style":454},[712],{"type":47,"value":713},"unauthenticated",{"type":41,"tag":81,"props":715,"children":716},{"style":242},[717],{"type":47,"value":574},{"type":41,"tag":81,"props":719,"children":720},{"style":104},[721],{"type":47,"value":149},{"type":41,"tag":81,"props":723,"children":724},{"style":141},[725],{"type":47,"value":726},"invalid token",{"type":41,"tag":81,"props":728,"children":729},{"style":104},[730],{"type":47,"value":149},{"type":41,"tag":81,"props":732,"children":733},{"style":242},[734],{"type":47,"value":508},{"type":41,"tag":81,"props":736,"children":737},{"style":104},[738],{"type":47,"value":154},{"type":41,"tag":81,"props":740,"children":742},{"class":83,"line":741},25,[743],{"type":41,"tag":81,"props":744,"children":745},{"style":104},[746],{"type":47,"value":747},"    }\n",{"type":41,"tag":81,"props":749,"children":750},{"class":83,"line":21},[751],{"type":41,"tag":81,"props":752,"children":753},{"style":242},[754],{"type":47,"value":613},{"type":41,"tag":81,"props":756,"children":758},{"class":83,"line":757},27,[759,764],{"type":41,"tag":81,"props":760,"children":761},{"style":98},[762],{"type":47,"value":763},"    return",{"type":41,"tag":81,"props":765,"children":766},{"style":104},[767],{"type":47,"value":235},{"type":41,"tag":81,"props":769,"children":771},{"class":83,"line":770},28,[772,777,781,785,789,794],{"type":41,"tag":81,"props":773,"children":774},{"style":242},[775],{"type":47,"value":776},"      userID",{"type":41,"tag":81,"props":778,"children":779},{"style":104},[780],{"type":47,"value":250},{"type":41,"tag":81,"props":782,"children":783},{"style":110},[784],{"type":47,"value":626},{"type":41,"tag":81,"props":786,"children":787},{"style":104},[788],{"type":47,"value":555},{"type":41,"tag":81,"props":790,"children":791},{"style":110},[792],{"type":47,"value":793},"sub",{"type":41,"tag":81,"props":795,"children":796},{"style":104},[797],{"type":47,"value":798},",\n",{"type":41,"tag":81,"props":800,"children":802},{"class":83,"line":801},29,[803,808,812,816,820,825],{"type":41,"tag":81,"props":804,"children":805},{"style":242},[806],{"type":47,"value":807},"      email",{"type":41,"tag":81,"props":809,"children":810},{"style":104},[811],{"type":47,"value":250},{"type":41,"tag":81,"props":813,"children":814},{"style":110},[815],{"type":47,"value":626},{"type":41,"tag":81,"props":817,"children":818},{"style":104},[819],{"type":47,"value":555},{"type":41,"tag":81,"props":821,"children":822},{"style":110},[823],{"type":47,"value":824},"email",{"type":41,"tag":81,"props":826,"children":827},{"style":104},[828],{"type":47,"value":798},{"type":41,"tag":81,"props":830,"children":832},{"class":83,"line":831},30,[833,838,842,846,850,855],{"type":41,"tag":81,"props":834,"children":835},{"style":242},[836],{"type":47,"value":837},"      role",{"type":41,"tag":81,"props":839,"children":840},{"style":104},[841],{"type":47,"value":250},{"type":41,"tag":81,"props":843,"children":844},{"style":110},[845],{"type":47,"value":626},{"type":41,"tag":81,"props":847,"children":848},{"style":104},[849],{"type":47,"value":555},{"type":41,"tag":81,"props":851,"children":852},{"style":110},[853],{"type":47,"value":854},"role",{"type":41,"tag":81,"props":856,"children":857},{"style":104},[858],{"type":47,"value":798},{"type":41,"tag":81,"props":860,"children":862},{"class":83,"line":861},31,[863],{"type":41,"tag":81,"props":864,"children":865},{"style":104},[866],{"type":47,"value":867},"    };\n",{"type":41,"tag":81,"props":869,"children":871},{"class":83,"line":870},32,[872],{"type":41,"tag":81,"props":873,"children":874},{"style":104},[875],{"type":47,"value":876},"  }\n",{"type":41,"tag":81,"props":878,"children":880},{"class":83,"line":879},33,[881,885],{"type":41,"tag":81,"props":882,"children":883},{"style":110},[884],{"type":47,"value":508},{"type":41,"tag":81,"props":886,"children":887},{"style":104},[888],{"type":47,"value":154},{"type":41,"tag":81,"props":890,"children":892},{"class":83,"line":891},34,[893],{"type":41,"tag":81,"props":894,"children":895},{"emptyLinePlaceholder":203},[896],{"type":47,"value":206},{"type":41,"tag":81,"props":898,"children":900},{"class":83,"line":899},35,[901],{"type":41,"tag":81,"props":902,"children":903},{"style":88},[904],{"type":47,"value":905},"\u002F\u002F Register the auth handler with a Gateway\n",{"type":41,"tag":81,"props":907,"children":909},{"class":83,"line":908},36,[910,914,918,923,927,932,936,940],{"type":41,"tag":81,"props":911,"children":912},{"style":98},[913],{"type":47,"value":436},{"type":41,"tag":81,"props":915,"children":916},{"style":221},[917],{"type":47,"value":441},{"type":41,"tag":81,"props":919,"children":920},{"style":110},[921],{"type":47,"value":922}," gateway ",{"type":41,"tag":81,"props":924,"children":925},{"style":104},[926],{"type":47,"value":451},{"type":41,"tag":81,"props":928,"children":929},{"style":104},[930],{"type":47,"value":931}," new",{"type":41,"tag":81,"props":933,"children":934},{"style":454},[935],{"type":47,"value":123},{"type":41,"tag":81,"props":937,"children":938},{"style":110},[939],{"type":47,"value":574},{"type":41,"tag":81,"props":941,"children":942},{"style":104},[943],{"type":47,"value":690},{"type":41,"tag":81,"props":945,"children":947},{"class":83,"line":946},37,[948,953,957,962],{"type":41,"tag":81,"props":949,"children":950},{"style":242},[951],{"type":47,"value":952},"  authHandler",{"type":41,"tag":81,"props":954,"children":955},{"style":104},[956],{"type":47,"value":250},{"type":41,"tag":81,"props":958,"children":959},{"style":110},[960],{"type":47,"value":961}," auth",{"type":41,"tag":81,"props":963,"children":964},{"style":104},[965],{"type":47,"value":798},{"type":41,"tag":81,"props":967,"children":969},{"class":83,"line":968},38,[970,975,979],{"type":41,"tag":81,"props":971,"children":972},{"style":104},[973],{"type":47,"value":974},"}",{"type":41,"tag":81,"props":976,"children":977},{"style":110},[978],{"type":47,"value":508},{"type":41,"tag":81,"props":980,"children":981},{"style":104},[982],{"type":47,"value":154},{"type":41,"tag":63,"props":984,"children":986},{"id":985},"_2-protect-endpoints",[987],{"type":47,"value":988},"2. Protect Endpoints",{"type":41,"tag":70,"props":990,"children":992},{"className":72,"code":991,"language":19,"meta":74,"style":74},"import { api } from \"encore.dev\u002Fapi\";\n\n\u002F\u002F Protected endpoint - requires authentication\nexport const getProfile = api(\n  { method: \"GET\", path: \"\u002Fprofile\", expose: true, auth: true },\n  async (): Promise\u003CProfile> => {\n    \u002F\u002F Only authenticated users reach here\n  }\n);\n\n\u002F\u002F Public endpoint - no authentication required\nexport const healthCheck = api(\n  { method: \"GET\", path: \"\u002Fhealth\", expose: true },\n  async () => ({ status: \"ok\" })\n);\n",[993],{"type":41,"tag":77,"props":994,"children":995},{"__ignoreMap":74},[996,1036,1043,1051,1079,1175,1213,1221,1228,1239,1246,1254,1282,1354,1410],{"type":41,"tag":81,"props":997,"children":998},{"class":83,"line":84},[999,1003,1007,1012,1016,1020,1024,1028,1032],{"type":41,"tag":81,"props":1000,"children":1001},{"style":98},[1002],{"type":47,"value":101},{"type":41,"tag":81,"props":1004,"children":1005},{"style":104},[1006],{"type":47,"value":107},{"type":41,"tag":81,"props":1008,"children":1009},{"style":110},[1010],{"type":47,"value":1011}," api",{"type":41,"tag":81,"props":1013,"children":1014},{"style":104},[1015],{"type":47,"value":128},{"type":41,"tag":81,"props":1017,"children":1018},{"style":98},[1019],{"type":47,"value":133},{"type":41,"tag":81,"props":1021,"children":1022},{"style":104},[1023],{"type":47,"value":138},{"type":41,"tag":81,"props":1025,"children":1026},{"style":141},[1027],{"type":47,"value":144},{"type":41,"tag":81,"props":1029,"children":1030},{"style":104},[1031],{"type":47,"value":149},{"type":41,"tag":81,"props":1033,"children":1034},{"style":104},[1035],{"type":47,"value":154},{"type":41,"tag":81,"props":1037,"children":1038},{"class":83,"line":94},[1039],{"type":41,"tag":81,"props":1040,"children":1041},{"emptyLinePlaceholder":203},[1042],{"type":47,"value":206},{"type":41,"tag":81,"props":1044,"children":1045},{"class":83,"line":157},[1046],{"type":41,"tag":81,"props":1047,"children":1048},{"style":88},[1049],{"type":47,"value":1050},"\u002F\u002F Protected endpoint - requires authentication\n",{"type":41,"tag":81,"props":1052,"children":1053},{"class":83,"line":199},[1054,1058,1062,1067,1071,1075],{"type":41,"tag":81,"props":1055,"children":1056},{"style":98},[1057],{"type":47,"value":436},{"type":41,"tag":81,"props":1059,"children":1060},{"style":221},[1061],{"type":47,"value":441},{"type":41,"tag":81,"props":1063,"children":1064},{"style":110},[1065],{"type":47,"value":1066}," getProfile ",{"type":41,"tag":81,"props":1068,"children":1069},{"style":104},[1070],{"type":47,"value":451},{"type":41,"tag":81,"props":1072,"children":1073},{"style":454},[1074],{"type":47,"value":1011},{"type":41,"tag":81,"props":1076,"children":1077},{"style":110},[1078],{"type":47,"value":483},{"type":41,"tag":81,"props":1080,"children":1081},{"class":83,"line":25},[1082,1087,1092,1096,1100,1105,1109,1113,1118,1122,1126,1131,1135,1139,1144,1148,1154,1158,1162,1166,1170],{"type":41,"tag":81,"props":1083,"children":1084},{"style":104},[1085],{"type":47,"value":1086},"  {",{"type":41,"tag":81,"props":1088,"children":1089},{"style":242},[1090],{"type":47,"value":1091}," method",{"type":41,"tag":81,"props":1093,"children":1094},{"style":104},[1095],{"type":47,"value":250},{"type":41,"tag":81,"props":1097,"children":1098},{"style":104},[1099],{"type":47,"value":138},{"type":41,"tag":81,"props":1101,"children":1102},{"style":141},[1103],{"type":47,"value":1104},"GET",{"type":41,"tag":81,"props":1106,"children":1107},{"style":104},[1108],{"type":47,"value":149},{"type":41,"tag":81,"props":1110,"children":1111},{"style":104},[1112],{"type":47,"value":118},{"type":41,"tag":81,"props":1114,"children":1115},{"style":242},[1116],{"type":47,"value":1117}," path",{"type":41,"tag":81,"props":1119,"children":1120},{"style":104},[1121],{"type":47,"value":250},{"type":41,"tag":81,"props":1123,"children":1124},{"style":104},[1125],{"type":47,"value":138},{"type":41,"tag":81,"props":1127,"children":1128},{"style":141},[1129],{"type":47,"value":1130},"\u002Fprofile",{"type":41,"tag":81,"props":1132,"children":1133},{"style":104},[1134],{"type":47,"value":149},{"type":41,"tag":81,"props":1136,"children":1137},{"style":104},[1138],{"type":47,"value":118},{"type":41,"tag":81,"props":1140,"children":1141},{"style":242},[1142],{"type":47,"value":1143}," expose",{"type":41,"tag":81,"props":1145,"children":1146},{"style":104},[1147],{"type":47,"value":250},{"type":41,"tag":81,"props":1149,"children":1151},{"style":1150},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[1152],{"type":47,"value":1153}," true",{"type":41,"tag":81,"props":1155,"children":1156},{"style":104},[1157],{"type":47,"value":118},{"type":41,"tag":81,"props":1159,"children":1160},{"style":242},[1161],{"type":47,"value":961},{"type":41,"tag":81,"props":1163,"children":1164},{"style":104},[1165],{"type":47,"value":250},{"type":41,"tag":81,"props":1167,"children":1168},{"style":1150},[1169],{"type":47,"value":1153},{"type":41,"tag":81,"props":1171,"children":1172},{"style":104},[1173],{"type":47,"value":1174}," },\n",{"type":41,"tag":81,"props":1176,"children":1177},{"class":83,"line":217},[1178,1182,1187,1192,1196,1201,1205,1209],{"type":41,"tag":81,"props":1179,"children":1180},{"style":221},[1181],{"type":47,"value":492},{"type":41,"tag":81,"props":1183,"children":1184},{"style":104},[1185],{"type":47,"value":1186}," ():",{"type":41,"tag":81,"props":1188,"children":1189},{"style":227},[1190],{"type":47,"value":1191}," Promise",{"type":41,"tag":81,"props":1193,"children":1194},{"style":104},[1195],{"type":47,"value":259},{"type":41,"tag":81,"props":1197,"children":1198},{"style":227},[1199],{"type":47,"value":1200},"Profile",{"type":41,"tag":81,"props":1202,"children":1203},{"style":104},[1204],{"type":47,"value":478},{"type":41,"tag":81,"props":1206,"children":1207},{"style":221},[1208],{"type":47,"value":513},{"type":41,"tag":81,"props":1210,"children":1211},{"style":104},[1212],{"type":47,"value":235},{"type":41,"tag":81,"props":1214,"children":1215},{"class":83,"line":238},[1216],{"type":41,"tag":81,"props":1217,"children":1218},{"style":88},[1219],{"type":47,"value":1220},"    \u002F\u002F Only authenticated users reach here\n",{"type":41,"tag":81,"props":1222,"children":1223},{"class":83,"line":280},[1224],{"type":41,"tag":81,"props":1225,"children":1226},{"style":104},[1227],{"type":47,"value":876},{"type":41,"tag":81,"props":1229,"children":1230},{"class":83,"line":289},[1231,1235],{"type":41,"tag":81,"props":1232,"children":1233},{"style":110},[1234],{"type":47,"value":508},{"type":41,"tag":81,"props":1236,"children":1237},{"style":104},[1238],{"type":47,"value":154},{"type":41,"tag":81,"props":1240,"children":1241},{"class":83,"line":297},[1242],{"type":41,"tag":81,"props":1243,"children":1244},{"emptyLinePlaceholder":203},[1245],{"type":47,"value":206},{"type":41,"tag":81,"props":1247,"children":1248},{"class":83,"line":306},[1249],{"type":41,"tag":81,"props":1250,"children":1251},{"style":88},[1252],{"type":47,"value":1253},"\u002F\u002F Public endpoint - no authentication required\n",{"type":41,"tag":81,"props":1255,"children":1256},{"class":83,"line":323},[1257,1261,1265,1270,1274,1278],{"type":41,"tag":81,"props":1258,"children":1259},{"style":98},[1260],{"type":47,"value":436},{"type":41,"tag":81,"props":1262,"children":1263},{"style":221},[1264],{"type":47,"value":441},{"type":41,"tag":81,"props":1266,"children":1267},{"style":110},[1268],{"type":47,"value":1269}," healthCheck ",{"type":41,"tag":81,"props":1271,"children":1272},{"style":104},[1273],{"type":47,"value":451},{"type":41,"tag":81,"props":1275,"children":1276},{"style":454},[1277],{"type":47,"value":1011},{"type":41,"tag":81,"props":1279,"children":1280},{"style":110},[1281],{"type":47,"value":483},{"type":41,"tag":81,"props":1283,"children":1284},{"class":83,"line":345},[1285,1289,1293,1297,1301,1305,1309,1313,1317,1321,1325,1330,1334,1338,1342,1346,1350],{"type":41,"tag":81,"props":1286,"children":1287},{"style":104},[1288],{"type":47,"value":1086},{"type":41,"tag":81,"props":1290,"children":1291},{"style":242},[1292],{"type":47,"value":1091},{"type":41,"tag":81,"props":1294,"children":1295},{"style":104},[1296],{"type":47,"value":250},{"type":41,"tag":81,"props":1298,"children":1299},{"style":104},[1300],{"type":47,"value":138},{"type":41,"tag":81,"props":1302,"children":1303},{"style":141},[1304],{"type":47,"value":1104},{"type":41,"tag":81,"props":1306,"children":1307},{"style":104},[1308],{"type":47,"value":149},{"type":41,"tag":81,"props":1310,"children":1311},{"style":104},[1312],{"type":47,"value":118},{"type":41,"tag":81,"props":1314,"children":1315},{"style":242},[1316],{"type":47,"value":1117},{"type":41,"tag":81,"props":1318,"children":1319},{"style":104},[1320],{"type":47,"value":250},{"type":41,"tag":81,"props":1322,"children":1323},{"style":104},[1324],{"type":47,"value":138},{"type":41,"tag":81,"props":1326,"children":1327},{"style":141},[1328],{"type":47,"value":1329},"\u002Fhealth",{"type":41,"tag":81,"props":1331,"children":1332},{"style":104},[1333],{"type":47,"value":149},{"type":41,"tag":81,"props":1335,"children":1336},{"style":104},[1337],{"type":47,"value":118},{"type":41,"tag":81,"props":1339,"children":1340},{"style":242},[1341],{"type":47,"value":1143},{"type":41,"tag":81,"props":1343,"children":1344},{"style":104},[1345],{"type":47,"value":250},{"type":41,"tag":81,"props":1347,"children":1348},{"style":1150},[1349],{"type":47,"value":1153},{"type":41,"tag":81,"props":1351,"children":1352},{"style":104},[1353],{"type":47,"value":1174},{"type":41,"tag":81,"props":1355,"children":1356},{"class":83,"line":366},[1357,1361,1366,1370,1374,1379,1384,1388,1392,1397,1401,1405],{"type":41,"tag":81,"props":1358,"children":1359},{"style":221},[1360],{"type":47,"value":492},{"type":41,"tag":81,"props":1362,"children":1363},{"style":104},[1364],{"type":47,"value":1365}," ()",{"type":41,"tag":81,"props":1367,"children":1368},{"style":221},[1369],{"type":47,"value":513},{"type":41,"tag":81,"props":1371,"children":1372},{"style":110},[1373],{"type":47,"value":497},{"type":41,"tag":81,"props":1375,"children":1376},{"style":104},[1377],{"type":47,"value":1378},"{",{"type":41,"tag":81,"props":1380,"children":1381},{"style":242},[1382],{"type":47,"value":1383}," status",{"type":41,"tag":81,"props":1385,"children":1386},{"style":104},[1387],{"type":47,"value":250},{"type":41,"tag":81,"props":1389,"children":1390},{"style":104},[1391],{"type":47,"value":138},{"type":41,"tag":81,"props":1393,"children":1394},{"style":141},[1395],{"type":47,"value":1396},"ok",{"type":41,"tag":81,"props":1398,"children":1399},{"style":104},[1400],{"type":47,"value":149},{"type":41,"tag":81,"props":1402,"children":1403},{"style":104},[1404],{"type":47,"value":128},{"type":41,"tag":81,"props":1406,"children":1407},{"style":110},[1408],{"type":47,"value":1409},")\n",{"type":41,"tag":81,"props":1411,"children":1412},{"class":83,"line":414},[1413,1417],{"type":41,"tag":81,"props":1414,"children":1415},{"style":110},[1416],{"type":47,"value":508},{"type":41,"tag":81,"props":1418,"children":1419},{"style":104},[1420],{"type":47,"value":154},{"type":41,"tag":63,"props":1422,"children":1424},{"id":1423},"_3-access-auth-data-in-endpoints",[1425],{"type":47,"value":1426},"3. Access Auth Data in Endpoints",{"type":41,"tag":70,"props":1428,"children":1430},{"className":72,"code":1429,"language":19,"meta":74,"style":74},"import { api } from \"encore.dev\u002Fapi\";\nimport { getAuthData } from \"~encore\u002Fauth\";\n\nexport const getProfile = api(\n  { method: \"GET\", path: \"\u002Fprofile\", expose: true, auth: true },\n  async (): Promise\u003CProfile> => {\n    const auth = getAuthData()!;  \u002F\u002F Non-null when auth: true\n    \n    return {\n      userID: auth.userID,\n      email: auth.email,\n      role: auth.role,\n    };\n  }\n);\n",[1431],{"type":41,"tag":77,"props":1432,"children":1433},{"__ignoreMap":74},[1434,1473,1514,1521,1548,1635,1670,1704,1711,1722,1750,1777,1804,1811,1818],{"type":41,"tag":81,"props":1435,"children":1436},{"class":83,"line":84},[1437,1441,1445,1449,1453,1457,1461,1465,1469],{"type":41,"tag":81,"props":1438,"children":1439},{"style":98},[1440],{"type":47,"value":101},{"type":41,"tag":81,"props":1442,"children":1443},{"style":104},[1444],{"type":47,"value":107},{"type":41,"tag":81,"props":1446,"children":1447},{"style":110},[1448],{"type":47,"value":1011},{"type":41,"tag":81,"props":1450,"children":1451},{"style":104},[1452],{"type":47,"value":128},{"type":41,"tag":81,"props":1454,"children":1455},{"style":98},[1456],{"type":47,"value":133},{"type":41,"tag":81,"props":1458,"children":1459},{"style":104},[1460],{"type":47,"value":138},{"type":41,"tag":81,"props":1462,"children":1463},{"style":141},[1464],{"type":47,"value":144},{"type":41,"tag":81,"props":1466,"children":1467},{"style":104},[1468],{"type":47,"value":149},{"type":41,"tag":81,"props":1470,"children":1471},{"style":104},[1472],{"type":47,"value":154},{"type":41,"tag":81,"props":1474,"children":1475},{"class":83,"line":94},[1476,1480,1484,1489,1493,1497,1501,1506,1510],{"type":41,"tag":81,"props":1477,"children":1478},{"style":98},[1479],{"type":47,"value":101},{"type":41,"tag":81,"props":1481,"children":1482},{"style":104},[1483],{"type":47,"value":107},{"type":41,"tag":81,"props":1485,"children":1486},{"style":110},[1487],{"type":47,"value":1488}," getAuthData",{"type":41,"tag":81,"props":1490,"children":1491},{"style":104},[1492],{"type":47,"value":128},{"type":41,"tag":81,"props":1494,"children":1495},{"style":98},[1496],{"type":47,"value":133},{"type":41,"tag":81,"props":1498,"children":1499},{"style":104},[1500],{"type":47,"value":138},{"type":41,"tag":81,"props":1502,"children":1503},{"style":141},[1504],{"type":47,"value":1505},"~encore\u002Fauth",{"type":41,"tag":81,"props":1507,"children":1508},{"style":104},[1509],{"type":47,"value":149},{"type":41,"tag":81,"props":1511,"children":1512},{"style":104},[1513],{"type":47,"value":154},{"type":41,"tag":81,"props":1515,"children":1516},{"class":83,"line":157},[1517],{"type":41,"tag":81,"props":1518,"children":1519},{"emptyLinePlaceholder":203},[1520],{"type":47,"value":206},{"type":41,"tag":81,"props":1522,"children":1523},{"class":83,"line":199},[1524,1528,1532,1536,1540,1544],{"type":41,"tag":81,"props":1525,"children":1526},{"style":98},[1527],{"type":47,"value":436},{"type":41,"tag":81,"props":1529,"children":1530},{"style":221},[1531],{"type":47,"value":441},{"type":41,"tag":81,"props":1533,"children":1534},{"style":110},[1535],{"type":47,"value":1066},{"type":41,"tag":81,"props":1537,"children":1538},{"style":104},[1539],{"type":47,"value":451},{"type":41,"tag":81,"props":1541,"children":1542},{"style":454},[1543],{"type":47,"value":1011},{"type":41,"tag":81,"props":1545,"children":1546},{"style":110},[1547],{"type":47,"value":483},{"type":41,"tag":81,"props":1549,"children":1550},{"class":83,"line":25},[1551,1555,1559,1563,1567,1571,1575,1579,1583,1587,1591,1595,1599,1603,1607,1611,1615,1619,1623,1627,1631],{"type":41,"tag":81,"props":1552,"children":1553},{"style":104},[1554],{"type":47,"value":1086},{"type":41,"tag":81,"props":1556,"children":1557},{"style":242},[1558],{"type":47,"value":1091},{"type":41,"tag":81,"props":1560,"children":1561},{"style":104},[1562],{"type":47,"value":250},{"type":41,"tag":81,"props":1564,"children":1565},{"style":104},[1566],{"type":47,"value":138},{"type":41,"tag":81,"props":1568,"children":1569},{"style":141},[1570],{"type":47,"value":1104},{"type":41,"tag":81,"props":1572,"children":1573},{"style":104},[1574],{"type":47,"value":149},{"type":41,"tag":81,"props":1576,"children":1577},{"style":104},[1578],{"type":47,"value":118},{"type":41,"tag":81,"props":1580,"children":1581},{"style":242},[1582],{"type":47,"value":1117},{"type":41,"tag":81,"props":1584,"children":1585},{"style":104},[1586],{"type":47,"value":250},{"type":41,"tag":81,"props":1588,"children":1589},{"style":104},[1590],{"type":47,"value":138},{"type":41,"tag":81,"props":1592,"children":1593},{"style":141},[1594],{"type":47,"value":1130},{"type":41,"tag":81,"props":1596,"children":1597},{"style":104},[1598],{"type":47,"value":149},{"type":41,"tag":81,"props":1600,"children":1601},{"style":104},[1602],{"type":47,"value":118},{"type":41,"tag":81,"props":1604,"children":1605},{"style":242},[1606],{"type":47,"value":1143},{"type":41,"tag":81,"props":1608,"children":1609},{"style":104},[1610],{"type":47,"value":250},{"type":41,"tag":81,"props":1612,"children":1613},{"style":1150},[1614],{"type":47,"value":1153},{"type":41,"tag":81,"props":1616,"children":1617},{"style":104},[1618],{"type":47,"value":118},{"type":41,"tag":81,"props":1620,"children":1621},{"style":242},[1622],{"type":47,"value":961},{"type":41,"tag":81,"props":1624,"children":1625},{"style":104},[1626],{"type":47,"value":250},{"type":41,"tag":81,"props":1628,"children":1629},{"style":1150},[1630],{"type":47,"value":1153},{"type":41,"tag":81,"props":1632,"children":1633},{"style":104},[1634],{"type":47,"value":1174},{"type":41,"tag":81,"props":1636,"children":1637},{"class":83,"line":217},[1638,1642,1646,1650,1654,1658,1662,1666],{"type":41,"tag":81,"props":1639,"children":1640},{"style":221},[1641],{"type":47,"value":492},{"type":41,"tag":81,"props":1643,"children":1644},{"style":104},[1645],{"type":47,"value":1186},{"type":41,"tag":81,"props":1647,"children":1648},{"style":227},[1649],{"type":47,"value":1191},{"type":41,"tag":81,"props":1651,"children":1652},{"style":104},[1653],{"type":47,"value":259},{"type":41,"tag":81,"props":1655,"children":1656},{"style":227},[1657],{"type":47,"value":1200},{"type":41,"tag":81,"props":1659,"children":1660},{"style":104},[1661],{"type":47,"value":478},{"type":41,"tag":81,"props":1663,"children":1664},{"style":221},[1665],{"type":47,"value":513},{"type":41,"tag":81,"props":1667,"children":1668},{"style":104},[1669],{"type":47,"value":235},{"type":41,"tag":81,"props":1671,"children":1672},{"class":83,"line":238},[1673,1677,1681,1685,1689,1694,1699],{"type":41,"tag":81,"props":1674,"children":1675},{"style":221},[1676],{"type":47,"value":535},{"type":41,"tag":81,"props":1678,"children":1679},{"style":110},[1680],{"type":47,"value":961},{"type":41,"tag":81,"props":1682,"children":1683},{"style":104},[1684],{"type":47,"value":545},{"type":41,"tag":81,"props":1686,"children":1687},{"style":454},[1688],{"type":47,"value":1488},{"type":41,"tag":81,"props":1690,"children":1691},{"style":242},[1692],{"type":47,"value":1693},"()",{"type":41,"tag":81,"props":1695,"children":1696},{"style":104},[1697],{"type":47,"value":1698},"!;",{"type":41,"tag":81,"props":1700,"children":1701},{"style":88},[1702],{"type":47,"value":1703},"  \u002F\u002F Non-null when auth: true\n",{"type":41,"tag":81,"props":1705,"children":1706},{"class":83,"line":280},[1707],{"type":41,"tag":81,"props":1708,"children":1709},{"style":242},[1710],{"type":47,"value":613},{"type":41,"tag":81,"props":1712,"children":1713},{"class":83,"line":289},[1714,1718],{"type":41,"tag":81,"props":1715,"children":1716},{"style":98},[1717],{"type":47,"value":763},{"type":41,"tag":81,"props":1719,"children":1720},{"style":104},[1721],{"type":47,"value":235},{"type":41,"tag":81,"props":1723,"children":1724},{"class":83,"line":297},[1725,1729,1733,1737,1741,1746],{"type":41,"tag":81,"props":1726,"children":1727},{"style":242},[1728],{"type":47,"value":776},{"type":41,"tag":81,"props":1730,"children":1731},{"style":104},[1732],{"type":47,"value":250},{"type":41,"tag":81,"props":1734,"children":1735},{"style":110},[1736],{"type":47,"value":961},{"type":41,"tag":81,"props":1738,"children":1739},{"style":104},[1740],{"type":47,"value":555},{"type":41,"tag":81,"props":1742,"children":1743},{"style":110},[1744],{"type":47,"value":1745},"userID",{"type":41,"tag":81,"props":1747,"children":1748},{"style":104},[1749],{"type":47,"value":798},{"type":41,"tag":81,"props":1751,"children":1752},{"class":83,"line":306},[1753,1757,1761,1765,1769,1773],{"type":41,"tag":81,"props":1754,"children":1755},{"style":242},[1756],{"type":47,"value":807},{"type":41,"tag":81,"props":1758,"children":1759},{"style":104},[1760],{"type":47,"value":250},{"type":41,"tag":81,"props":1762,"children":1763},{"style":110},[1764],{"type":47,"value":961},{"type":41,"tag":81,"props":1766,"children":1767},{"style":104},[1768],{"type":47,"value":555},{"type":41,"tag":81,"props":1770,"children":1771},{"style":110},[1772],{"type":47,"value":824},{"type":41,"tag":81,"props":1774,"children":1775},{"style":104},[1776],{"type":47,"value":798},{"type":41,"tag":81,"props":1778,"children":1779},{"class":83,"line":323},[1780,1784,1788,1792,1796,1800],{"type":41,"tag":81,"props":1781,"children":1782},{"style":242},[1783],{"type":47,"value":837},{"type":41,"tag":81,"props":1785,"children":1786},{"style":104},[1787],{"type":47,"value":250},{"type":41,"tag":81,"props":1789,"children":1790},{"style":110},[1791],{"type":47,"value":961},{"type":41,"tag":81,"props":1793,"children":1794},{"style":104},[1795],{"type":47,"value":555},{"type":41,"tag":81,"props":1797,"children":1798},{"style":110},[1799],{"type":47,"value":854},{"type":41,"tag":81,"props":1801,"children":1802},{"style":104},[1803],{"type":47,"value":798},{"type":41,"tag":81,"props":1805,"children":1806},{"class":83,"line":345},[1807],{"type":41,"tag":81,"props":1808,"children":1809},{"style":104},[1810],{"type":47,"value":867},{"type":41,"tag":81,"props":1812,"children":1813},{"class":83,"line":366},[1814],{"type":41,"tag":81,"props":1815,"children":1816},{"style":104},[1817],{"type":47,"value":876},{"type":41,"tag":81,"props":1819,"children":1820},{"class":83,"line":414},[1821,1825],{"type":41,"tag":81,"props":1822,"children":1823},{"style":110},[1824],{"type":47,"value":508},{"type":41,"tag":81,"props":1826,"children":1827},{"style":104},[1828],{"type":47,"value":154},{"type":41,"tag":50,"props":1830,"children":1832},{"id":1831},"auth-handler-behavior",[1833],{"type":47,"value":1834},"Auth Handler Behavior",{"type":41,"tag":1836,"props":1837,"children":1838},"table",{},[1839,1863],{"type":41,"tag":1840,"props":1841,"children":1842},"thead",{},[1843],{"type":41,"tag":1844,"props":1845,"children":1846},"tr",{},[1847,1853,1858],{"type":41,"tag":1848,"props":1849,"children":1850},"th",{},[1851],{"type":47,"value":1852},"Scenario",{"type":41,"tag":1848,"props":1854,"children":1855},{},[1856],{"type":47,"value":1857},"Handler Returns",{"type":41,"tag":1848,"props":1859,"children":1860},{},[1861],{"type":47,"value":1862},"Result",{"type":41,"tag":1864,"props":1865,"children":1866},"tbody",{},[1867,1892,1916],{"type":41,"tag":1844,"props":1868,"children":1869},{},[1870,1876,1887],{"type":41,"tag":1871,"props":1872,"children":1873},"td",{},[1874],{"type":47,"value":1875},"Valid credentials",{"type":41,"tag":1871,"props":1877,"children":1878},{},[1879,1885],{"type":41,"tag":77,"props":1880,"children":1882},{"className":1881},[],[1883],{"type":47,"value":1884},"AuthData",{"type":47,"value":1886}," object",{"type":41,"tag":1871,"props":1888,"children":1889},{},[1890],{"type":47,"value":1891},"Request authenticated",{"type":41,"tag":1844,"props":1893,"children":1894},{},[1895,1900,1911],{"type":41,"tag":1871,"props":1896,"children":1897},{},[1898],{"type":47,"value":1899},"Invalid credentials",{"type":41,"tag":1871,"props":1901,"children":1902},{},[1903,1905],{"type":47,"value":1904},"Throws ",{"type":41,"tag":77,"props":1906,"children":1908},{"className":1907},[],[1909],{"type":47,"value":1910},"APIError.unauthenticated()",{"type":41,"tag":1871,"props":1912,"children":1913},{},[1914],{"type":47,"value":1915},"Treated as no auth",{"type":41,"tag":1844,"props":1917,"children":1918},{},[1919,1924,1929],{"type":41,"tag":1871,"props":1920,"children":1921},{},[1922],{"type":47,"value":1923},"Other error",{"type":41,"tag":1871,"props":1925,"children":1926},{},[1927],{"type":47,"value":1928},"Throws other error",{"type":41,"tag":1871,"props":1930,"children":1931},{},[1932],{"type":47,"value":1933},"Request aborted",{"type":41,"tag":50,"props":1935,"children":1937},{"id":1936},"auth-with-endpoints",[1938],{"type":47,"value":1939},"Auth with Endpoints",{"type":41,"tag":1836,"props":1941,"children":1942},{},[1943,1963],{"type":41,"tag":1840,"props":1944,"children":1945},{},[1946],{"type":41,"tag":1844,"props":1947,"children":1948},{},[1949,1954,1959],{"type":41,"tag":1848,"props":1950,"children":1951},{},[1952],{"type":47,"value":1953},"Endpoint Config",{"type":41,"tag":1848,"props":1955,"children":1956},{},[1957],{"type":47,"value":1958},"Request Has Auth",{"type":41,"tag":1848,"props":1960,"children":1961},{},[1962],{"type":47,"value":1862},{"type":41,"tag":1864,"props":1964,"children":1965},{},[1966,1988,2009,2032],{"type":41,"tag":1844,"props":1967,"children":1968},{},[1969,1978,1983],{"type":41,"tag":1871,"props":1970,"children":1971},{},[1972],{"type":41,"tag":77,"props":1973,"children":1975},{"className":1974},[],[1976],{"type":47,"value":1977},"auth: true",{"type":41,"tag":1871,"props":1979,"children":1980},{},[1981],{"type":47,"value":1982},"Yes",{"type":41,"tag":1871,"props":1984,"children":1985},{},[1986],{"type":47,"value":1987},"Proceeds with auth data",{"type":41,"tag":1844,"props":1989,"children":1990},{},[1991,1999,2004],{"type":41,"tag":1871,"props":1992,"children":1993},{},[1994],{"type":41,"tag":77,"props":1995,"children":1997},{"className":1996},[],[1998],{"type":47,"value":1977},{"type":41,"tag":1871,"props":2000,"children":2001},{},[2002],{"type":47,"value":2003},"No",{"type":41,"tag":1871,"props":2005,"children":2006},{},[2007],{"type":47,"value":2008},"401 Unauthenticated",{"type":41,"tag":1844,"props":2010,"children":2011},{},[2012,2023,2027],{"type":41,"tag":1871,"props":2013,"children":2014},{},[2015,2021],{"type":41,"tag":77,"props":2016,"children":2018},{"className":2017},[],[2019],{"type":47,"value":2020},"auth: false",{"type":47,"value":2022}," or omitted",{"type":41,"tag":1871,"props":2024,"children":2025},{},[2026],{"type":47,"value":1982},{"type":41,"tag":1871,"props":2028,"children":2029},{},[2030],{"type":47,"value":2031},"Proceeds (auth data available)",{"type":41,"tag":1844,"props":2033,"children":2034},{},[2035,2044,2048],{"type":41,"tag":1871,"props":2036,"children":2037},{},[2038,2043],{"type":41,"tag":77,"props":2039,"children":2041},{"className":2040},[],[2042],{"type":47,"value":2020},{"type":47,"value":2022},{"type":41,"tag":1871,"props":2045,"children":2046},{},[2047],{"type":47,"value":2003},{"type":41,"tag":1871,"props":2049,"children":2050},{},[2051],{"type":47,"value":2052},"Proceeds (no auth data)",{"type":41,"tag":50,"props":2054,"children":2056},{"id":2055},"service-to-service-auth-propagation",[2057],{"type":47,"value":2058},"Service-to-Service Auth Propagation",{"type":41,"tag":57,"props":2060,"children":2061},{},[2062],{"type":47,"value":2063},"Auth data automatically propagates to internal service calls:",{"type":41,"tag":70,"props":2065,"children":2067},{"className":72,"code":2066,"language":19,"meta":74,"style":74},"import { user } from \"~encore\u002Fclients\";\nimport { getAuthData } from \"~encore\u002Fauth\";\n\nexport const getOrderWithUser = api(\n  { method: \"GET\", path: \"\u002Forders\u002F:id\", expose: true, auth: true },\n  async ({ id }): Promise\u003COrderWithUser> => {\n    const auth = getAuthData()!;\n\n    \u002F\u002F Auth is automatically propagated to this call\n    const orderUser = await user.getProfile();\n\n    return { order: await getOrder(id), user: orderUser };\n  }\n);\n",[2068],{"type":41,"tag":77,"props":2069,"children":2070},{"__ignoreMap":74},[2071,2112,2151,2158,2186,2274,2321,2349,2356,2364,2405,2412,2475,2482],{"type":41,"tag":81,"props":2072,"children":2073},{"class":83,"line":84},[2074,2078,2082,2087,2091,2095,2099,2104,2108],{"type":41,"tag":81,"props":2075,"children":2076},{"style":98},[2077],{"type":47,"value":101},{"type":41,"tag":81,"props":2079,"children":2080},{"style":104},[2081],{"type":47,"value":107},{"type":41,"tag":81,"props":2083,"children":2084},{"style":110},[2085],{"type":47,"value":2086}," user",{"type":41,"tag":81,"props":2088,"children":2089},{"style":104},[2090],{"type":47,"value":128},{"type":41,"tag":81,"props":2092,"children":2093},{"style":98},[2094],{"type":47,"value":133},{"type":41,"tag":81,"props":2096,"children":2097},{"style":104},[2098],{"type":47,"value":138},{"type":41,"tag":81,"props":2100,"children":2101},{"style":141},[2102],{"type":47,"value":2103},"~encore\u002Fclients",{"type":41,"tag":81,"props":2105,"children":2106},{"style":104},[2107],{"type":47,"value":149},{"type":41,"tag":81,"props":2109,"children":2110},{"style":104},[2111],{"type":47,"value":154},{"type":41,"tag":81,"props":2113,"children":2114},{"class":83,"line":94},[2115,2119,2123,2127,2131,2135,2139,2143,2147],{"type":41,"tag":81,"props":2116,"children":2117},{"style":98},[2118],{"type":47,"value":101},{"type":41,"tag":81,"props":2120,"children":2121},{"style":104},[2122],{"type":47,"value":107},{"type":41,"tag":81,"props":2124,"children":2125},{"style":110},[2126],{"type":47,"value":1488},{"type":41,"tag":81,"props":2128,"children":2129},{"style":104},[2130],{"type":47,"value":128},{"type":41,"tag":81,"props":2132,"children":2133},{"style":98},[2134],{"type":47,"value":133},{"type":41,"tag":81,"props":2136,"children":2137},{"style":104},[2138],{"type":47,"value":138},{"type":41,"tag":81,"props":2140,"children":2141},{"style":141},[2142],{"type":47,"value":1505},{"type":41,"tag":81,"props":2144,"children":2145},{"style":104},[2146],{"type":47,"value":149},{"type":41,"tag":81,"props":2148,"children":2149},{"style":104},[2150],{"type":47,"value":154},{"type":41,"tag":81,"props":2152,"children":2153},{"class":83,"line":157},[2154],{"type":41,"tag":81,"props":2155,"children":2156},{"emptyLinePlaceholder":203},[2157],{"type":47,"value":206},{"type":41,"tag":81,"props":2159,"children":2160},{"class":83,"line":199},[2161,2165,2169,2174,2178,2182],{"type":41,"tag":81,"props":2162,"children":2163},{"style":98},[2164],{"type":47,"value":436},{"type":41,"tag":81,"props":2166,"children":2167},{"style":221},[2168],{"type":47,"value":441},{"type":41,"tag":81,"props":2170,"children":2171},{"style":110},[2172],{"type":47,"value":2173}," getOrderWithUser ",{"type":41,"tag":81,"props":2175,"children":2176},{"style":104},[2177],{"type":47,"value":451},{"type":41,"tag":81,"props":2179,"children":2180},{"style":454},[2181],{"type":47,"value":1011},{"type":41,"tag":81,"props":2183,"children":2184},{"style":110},[2185],{"type":47,"value":483},{"type":41,"tag":81,"props":2187,"children":2188},{"class":83,"line":25},[2189,2193,2197,2201,2205,2209,2213,2217,2221,2225,2229,2234,2238,2242,2246,2250,2254,2258,2262,2266,2270],{"type":41,"tag":81,"props":2190,"children":2191},{"style":104},[2192],{"type":47,"value":1086},{"type":41,"tag":81,"props":2194,"children":2195},{"style":242},[2196],{"type":47,"value":1091},{"type":41,"tag":81,"props":2198,"children":2199},{"style":104},[2200],{"type":47,"value":250},{"type":41,"tag":81,"props":2202,"children":2203},{"style":104},[2204],{"type":47,"value":138},{"type":41,"tag":81,"props":2206,"children":2207},{"style":141},[2208],{"type":47,"value":1104},{"type":41,"tag":81,"props":2210,"children":2211},{"style":104},[2212],{"type":47,"value":149},{"type":41,"tag":81,"props":2214,"children":2215},{"style":104},[2216],{"type":47,"value":118},{"type":41,"tag":81,"props":2218,"children":2219},{"style":242},[2220],{"type":47,"value":1117},{"type":41,"tag":81,"props":2222,"children":2223},{"style":104},[2224],{"type":47,"value":250},{"type":41,"tag":81,"props":2226,"children":2227},{"style":104},[2228],{"type":47,"value":138},{"type":41,"tag":81,"props":2230,"children":2231},{"style":141},[2232],{"type":47,"value":2233},"\u002Forders\u002F:id",{"type":41,"tag":81,"props":2235,"children":2236},{"style":104},[2237],{"type":47,"value":149},{"type":41,"tag":81,"props":2239,"children":2240},{"style":104},[2241],{"type":47,"value":118},{"type":41,"tag":81,"props":2243,"children":2244},{"style":242},[2245],{"type":47,"value":1143},{"type":41,"tag":81,"props":2247,"children":2248},{"style":104},[2249],{"type":47,"value":250},{"type":41,"tag":81,"props":2251,"children":2252},{"style":1150},[2253],{"type":47,"value":1153},{"type":41,"tag":81,"props":2255,"children":2256},{"style":104},[2257],{"type":47,"value":118},{"type":41,"tag":81,"props":2259,"children":2260},{"style":242},[2261],{"type":47,"value":961},{"type":41,"tag":81,"props":2263,"children":2264},{"style":104},[2265],{"type":47,"value":250},{"type":41,"tag":81,"props":2267,"children":2268},{"style":1150},[2269],{"type":47,"value":1153},{"type":41,"tag":81,"props":2271,"children":2272},{"style":104},[2273],{"type":47,"value":1174},{"type":41,"tag":81,"props":2275,"children":2276},{"class":83,"line":217},[2277,2281,2286,2291,2296,2300,2304,2309,2313,2317],{"type":41,"tag":81,"props":2278,"children":2279},{"style":221},[2280],{"type":47,"value":492},{"type":41,"tag":81,"props":2282,"children":2283},{"style":104},[2284],{"type":47,"value":2285}," ({",{"type":41,"tag":81,"props":2287,"children":2288},{"style":500},[2289],{"type":47,"value":2290}," id",{"type":41,"tag":81,"props":2292,"children":2293},{"style":104},[2294],{"type":47,"value":2295}," }):",{"type":41,"tag":81,"props":2297,"children":2298},{"style":227},[2299],{"type":47,"value":1191},{"type":41,"tag":81,"props":2301,"children":2302},{"style":104},[2303],{"type":47,"value":259},{"type":41,"tag":81,"props":2305,"children":2306},{"style":227},[2307],{"type":47,"value":2308},"OrderWithUser",{"type":41,"tag":81,"props":2310,"children":2311},{"style":104},[2312],{"type":47,"value":478},{"type":41,"tag":81,"props":2314,"children":2315},{"style":221},[2316],{"type":47,"value":513},{"type":41,"tag":81,"props":2318,"children":2319},{"style":104},[2320],{"type":47,"value":235},{"type":41,"tag":81,"props":2322,"children":2323},{"class":83,"line":238},[2324,2328,2332,2336,2340,2344],{"type":41,"tag":81,"props":2325,"children":2326},{"style":221},[2327],{"type":47,"value":535},{"type":41,"tag":81,"props":2329,"children":2330},{"style":110},[2331],{"type":47,"value":961},{"type":41,"tag":81,"props":2333,"children":2334},{"style":104},[2335],{"type":47,"value":545},{"type":41,"tag":81,"props":2337,"children":2338},{"style":454},[2339],{"type":47,"value":1488},{"type":41,"tag":81,"props":2341,"children":2342},{"style":242},[2343],{"type":47,"value":1693},{"type":41,"tag":81,"props":2345,"children":2346},{"style":104},[2347],{"type":47,"value":2348},"!;\n",{"type":41,"tag":81,"props":2350,"children":2351},{"class":83,"line":280},[2352],{"type":41,"tag":81,"props":2353,"children":2354},{"emptyLinePlaceholder":203},[2355],{"type":47,"value":206},{"type":41,"tag":81,"props":2357,"children":2358},{"class":83,"line":289},[2359],{"type":41,"tag":81,"props":2360,"children":2361},{"style":88},[2362],{"type":47,"value":2363},"    \u002F\u002F Auth is automatically propagated to this call\n",{"type":41,"tag":81,"props":2365,"children":2366},{"class":83,"line":297},[2367,2371,2376,2380,2384,2388,2392,2397,2401],{"type":41,"tag":81,"props":2368,"children":2369},{"style":221},[2370],{"type":47,"value":535},{"type":41,"tag":81,"props":2372,"children":2373},{"style":110},[2374],{"type":47,"value":2375}," orderUser",{"type":41,"tag":81,"props":2377,"children":2378},{"style":104},[2379],{"type":47,"value":545},{"type":41,"tag":81,"props":2381,"children":2382},{"style":98},[2383],{"type":47,"value":635},{"type":41,"tag":81,"props":2385,"children":2386},{"style":110},[2387],{"type":47,"value":2086},{"type":41,"tag":81,"props":2389,"children":2390},{"style":104},[2391],{"type":47,"value":555},{"type":41,"tag":81,"props":2393,"children":2394},{"style":454},[2395],{"type":47,"value":2396},"getProfile",{"type":41,"tag":81,"props":2398,"children":2399},{"style":242},[2400],{"type":47,"value":1693},{"type":41,"tag":81,"props":2402,"children":2403},{"style":104},[2404],{"type":47,"value":154},{"type":41,"tag":81,"props":2406,"children":2407},{"class":83,"line":306},[2408],{"type":41,"tag":81,"props":2409,"children":2410},{"emptyLinePlaceholder":203},[2411],{"type":47,"value":206},{"type":41,"tag":81,"props":2413,"children":2414},{"class":83,"line":323},[2415,2419,2423,2428,2432,2436,2441,2445,2450,2454,2458,2462,2466,2470],{"type":41,"tag":81,"props":2416,"children":2417},{"style":98},[2418],{"type":47,"value":763},{"type":41,"tag":81,"props":2420,"children":2421},{"style":104},[2422],{"type":47,"value":107},{"type":41,"tag":81,"props":2424,"children":2425},{"style":242},[2426],{"type":47,"value":2427}," order",{"type":41,"tag":81,"props":2429,"children":2430},{"style":104},[2431],{"type":47,"value":250},{"type":41,"tag":81,"props":2433,"children":2434},{"style":98},[2435],{"type":47,"value":635},{"type":41,"tag":81,"props":2437,"children":2438},{"style":454},[2439],{"type":47,"value":2440}," getOrder",{"type":41,"tag":81,"props":2442,"children":2443},{"style":242},[2444],{"type":47,"value":574},{"type":41,"tag":81,"props":2446,"children":2447},{"style":110},[2448],{"type":47,"value":2449},"id",{"type":41,"tag":81,"props":2451,"children":2452},{"style":242},[2453],{"type":47,"value":508},{"type":41,"tag":81,"props":2455,"children":2456},{"style":104},[2457],{"type":47,"value":118},{"type":41,"tag":81,"props":2459,"children":2460},{"style":242},[2461],{"type":47,"value":2086},{"type":41,"tag":81,"props":2463,"children":2464},{"style":104},[2465],{"type":47,"value":250},{"type":41,"tag":81,"props":2467,"children":2468},{"style":110},[2469],{"type":47,"value":2375},{"type":41,"tag":81,"props":2471,"children":2472},{"style":104},[2473],{"type":47,"value":2474}," };\n",{"type":41,"tag":81,"props":2476,"children":2477},{"class":83,"line":345},[2478],{"type":41,"tag":81,"props":2479,"children":2480},{"style":104},[2481],{"type":47,"value":876},{"type":41,"tag":81,"props":2483,"children":2484},{"class":83,"line":366},[2485,2489],{"type":41,"tag":81,"props":2486,"children":2487},{"style":110},[2488],{"type":47,"value":508},{"type":41,"tag":81,"props":2490,"children":2491},{"style":104},[2492],{"type":47,"value":154},{"type":41,"tag":63,"props":2494,"children":2496},{"id":2495},"overriding-auth-data",[2497],{"type":47,"value":2498},"Overriding Auth Data",{"type":41,"tag":57,"props":2500,"children":2501},{},[2502],{"type":47,"value":2503},"You can explicitly override auth data when making service-to-service calls:",{"type":41,"tag":70,"props":2505,"children":2507},{"className":72,"code":2506,"language":19,"meta":74,"style":74},"import { user } from \"~encore\u002Fclients\";\n\n\u002F\u002F Override auth data for this specific call\nconst adminUser = await user.getProfile(\n  {},\n  { authData: { userID: \"admin-123\", email: \"admin@example.com\", role: \"admin\" } }\n);\n",[2508],{"type":41,"tag":77,"props":2509,"children":2510},{"__ignoreMap":74},[2511,2550,2557,2565,2602,2610,2712],{"type":41,"tag":81,"props":2512,"children":2513},{"class":83,"line":84},[2514,2518,2522,2526,2530,2534,2538,2542,2546],{"type":41,"tag":81,"props":2515,"children":2516},{"style":98},[2517],{"type":47,"value":101},{"type":41,"tag":81,"props":2519,"children":2520},{"style":104},[2521],{"type":47,"value":107},{"type":41,"tag":81,"props":2523,"children":2524},{"style":110},[2525],{"type":47,"value":2086},{"type":41,"tag":81,"props":2527,"children":2528},{"style":104},[2529],{"type":47,"value":128},{"type":41,"tag":81,"props":2531,"children":2532},{"style":98},[2533],{"type":47,"value":133},{"type":41,"tag":81,"props":2535,"children":2536},{"style":104},[2537],{"type":47,"value":138},{"type":41,"tag":81,"props":2539,"children":2540},{"style":141},[2541],{"type":47,"value":2103},{"type":41,"tag":81,"props":2543,"children":2544},{"style":104},[2545],{"type":47,"value":149},{"type":41,"tag":81,"props":2547,"children":2548},{"style":104},[2549],{"type":47,"value":154},{"type":41,"tag":81,"props":2551,"children":2552},{"class":83,"line":94},[2553],{"type":41,"tag":81,"props":2554,"children":2555},{"emptyLinePlaceholder":203},[2556],{"type":47,"value":206},{"type":41,"tag":81,"props":2558,"children":2559},{"class":83,"line":157},[2560],{"type":41,"tag":81,"props":2561,"children":2562},{"style":88},[2563],{"type":47,"value":2564},"\u002F\u002F Override auth data for this specific call\n",{"type":41,"tag":81,"props":2566,"children":2567},{"class":83,"line":199},[2568,2573,2578,2582,2586,2590,2594,2598],{"type":41,"tag":81,"props":2569,"children":2570},{"style":221},[2571],{"type":47,"value":2572},"const",{"type":41,"tag":81,"props":2574,"children":2575},{"style":110},[2576],{"type":47,"value":2577}," adminUser ",{"type":41,"tag":81,"props":2579,"children":2580},{"style":104},[2581],{"type":47,"value":451},{"type":41,"tag":81,"props":2583,"children":2584},{"style":98},[2585],{"type":47,"value":635},{"type":41,"tag":81,"props":2587,"children":2588},{"style":110},[2589],{"type":47,"value":2086},{"type":41,"tag":81,"props":2591,"children":2592},{"style":104},[2593],{"type":47,"value":555},{"type":41,"tag":81,"props":2595,"children":2596},{"style":454},[2597],{"type":47,"value":2396},{"type":41,"tag":81,"props":2599,"children":2600},{"style":110},[2601],{"type":47,"value":483},{"type":41,"tag":81,"props":2603,"children":2604},{"class":83,"line":25},[2605],{"type":41,"tag":81,"props":2606,"children":2607},{"style":104},[2608],{"type":47,"value":2609},"  {},\n",{"type":41,"tag":81,"props":2611,"children":2612},{"class":83,"line":217},[2613,2617,2622,2626,2630,2635,2639,2643,2648,2652,2656,2661,2665,2669,2674,2678,2682,2687,2691,2695,2699,2703,2707],{"type":41,"tag":81,"props":2614,"children":2615},{"style":104},[2616],{"type":47,"value":1086},{"type":41,"tag":81,"props":2618,"children":2619},{"style":242},[2620],{"type":47,"value":2621}," authData",{"type":41,"tag":81,"props":2623,"children":2624},{"style":104},[2625],{"type":47,"value":250},{"type":41,"tag":81,"props":2627,"children":2628},{"style":104},[2629],{"type":47,"value":107},{"type":41,"tag":81,"props":2631,"children":2632},{"style":242},[2633],{"type":47,"value":2634}," userID",{"type":41,"tag":81,"props":2636,"children":2637},{"style":104},[2638],{"type":47,"value":250},{"type":41,"tag":81,"props":2640,"children":2641},{"style":104},[2642],{"type":47,"value":138},{"type":41,"tag":81,"props":2644,"children":2645},{"style":141},[2646],{"type":47,"value":2647},"admin-123",{"type":41,"tag":81,"props":2649,"children":2650},{"style":104},[2651],{"type":47,"value":149},{"type":41,"tag":81,"props":2653,"children":2654},{"style":104},[2655],{"type":47,"value":118},{"type":41,"tag":81,"props":2657,"children":2658},{"style":242},[2659],{"type":47,"value":2660}," email",{"type":41,"tag":81,"props":2662,"children":2663},{"style":104},[2664],{"type":47,"value":250},{"type":41,"tag":81,"props":2666,"children":2667},{"style":104},[2668],{"type":47,"value":138},{"type":41,"tag":81,"props":2670,"children":2671},{"style":141},[2672],{"type":47,"value":2673},"admin@example.com",{"type":41,"tag":81,"props":2675,"children":2676},{"style":104},[2677],{"type":47,"value":149},{"type":41,"tag":81,"props":2679,"children":2680},{"style":104},[2681],{"type":47,"value":118},{"type":41,"tag":81,"props":2683,"children":2684},{"style":242},[2685],{"type":47,"value":2686}," role",{"type":41,"tag":81,"props":2688,"children":2689},{"style":104},[2690],{"type":47,"value":250},{"type":41,"tag":81,"props":2692,"children":2693},{"style":104},[2694],{"type":47,"value":138},{"type":41,"tag":81,"props":2696,"children":2697},{"style":141},[2698],{"type":47,"value":385},{"type":41,"tag":81,"props":2700,"children":2701},{"style":104},[2702],{"type":47,"value":149},{"type":41,"tag":81,"props":2704,"children":2705},{"style":104},[2706],{"type":47,"value":128},{"type":41,"tag":81,"props":2708,"children":2709},{"style":104},[2710],{"type":47,"value":2711}," }\n",{"type":41,"tag":81,"props":2713,"children":2714},{"class":83,"line":238},[2715,2719],{"type":41,"tag":81,"props":2716,"children":2717},{"style":110},[2718],{"type":47,"value":508},{"type":41,"tag":81,"props":2720,"children":2721},{"style":104},[2722],{"type":47,"value":154},{"type":41,"tag":50,"props":2724,"children":2726},{"id":2725},"common-auth-patterns",[2727],{"type":47,"value":2728},"Common Auth Patterns",{"type":41,"tag":63,"props":2730,"children":2732},{"id":2731},"jwt-token-validation",[2733],{"type":47,"value":2734},"JWT Token Validation",{"type":41,"tag":70,"props":2736,"children":2738},{"className":72,"code":2737,"language":19,"meta":74,"style":74},"import { jwtVerify } from \"jose\";\nimport { secret } from \"encore.dev\u002Fconfig\";\n\nconst jwtSecret = secret(\"JWTSecret\");\n\nasync function verifyToken(token: string): Promise\u003CJWTPayload | null> {\n  try {\n    const { payload } = await jwtVerify(\n      token,\n      new TextEncoder().encode(jwtSecret())\n    );\n    return payload;\n  } catch {\n    return null;\n  }\n}\n",[2739],{"type":41,"tag":77,"props":2740,"children":2741},{"__ignoreMap":74},[2742,2783,2824,2831,2876,2883,2951,2963,2998,3010,3050,3062,3077,3094,3106,3113],{"type":41,"tag":81,"props":2743,"children":2744},{"class":83,"line":84},[2745,2749,2753,2758,2762,2766,2770,2775,2779],{"type":41,"tag":81,"props":2746,"children":2747},{"style":98},[2748],{"type":47,"value":101},{"type":41,"tag":81,"props":2750,"children":2751},{"style":104},[2752],{"type":47,"value":107},{"type":41,"tag":81,"props":2754,"children":2755},{"style":110},[2756],{"type":47,"value":2757}," jwtVerify",{"type":41,"tag":81,"props":2759,"children":2760},{"style":104},[2761],{"type":47,"value":128},{"type":41,"tag":81,"props":2763,"children":2764},{"style":98},[2765],{"type":47,"value":133},{"type":41,"tag":81,"props":2767,"children":2768},{"style":104},[2769],{"type":47,"value":138},{"type":41,"tag":81,"props":2771,"children":2772},{"style":141},[2773],{"type":47,"value":2774},"jose",{"type":41,"tag":81,"props":2776,"children":2777},{"style":104},[2778],{"type":47,"value":149},{"type":41,"tag":81,"props":2780,"children":2781},{"style":104},[2782],{"type":47,"value":154},{"type":41,"tag":81,"props":2784,"children":2785},{"class":83,"line":94},[2786,2790,2794,2799,2803,2807,2811,2816,2820],{"type":41,"tag":81,"props":2787,"children":2788},{"style":98},[2789],{"type":47,"value":101},{"type":41,"tag":81,"props":2791,"children":2792},{"style":104},[2793],{"type":47,"value":107},{"type":41,"tag":81,"props":2795,"children":2796},{"style":110},[2797],{"type":47,"value":2798}," secret",{"type":41,"tag":81,"props":2800,"children":2801},{"style":104},[2802],{"type":47,"value":128},{"type":41,"tag":81,"props":2804,"children":2805},{"style":98},[2806],{"type":47,"value":133},{"type":41,"tag":81,"props":2808,"children":2809},{"style":104},[2810],{"type":47,"value":138},{"type":41,"tag":81,"props":2812,"children":2813},{"style":141},[2814],{"type":47,"value":2815},"encore.dev\u002Fconfig",{"type":41,"tag":81,"props":2817,"children":2818},{"style":104},[2819],{"type":47,"value":149},{"type":41,"tag":81,"props":2821,"children":2822},{"style":104},[2823],{"type":47,"value":154},{"type":41,"tag":81,"props":2825,"children":2826},{"class":83,"line":157},[2827],{"type":41,"tag":81,"props":2828,"children":2829},{"emptyLinePlaceholder":203},[2830],{"type":47,"value":206},{"type":41,"tag":81,"props":2832,"children":2833},{"class":83,"line":199},[2834,2838,2843,2847,2851,2855,2859,2864,2868,2872],{"type":41,"tag":81,"props":2835,"children":2836},{"style":221},[2837],{"type":47,"value":2572},{"type":41,"tag":81,"props":2839,"children":2840},{"style":110},[2841],{"type":47,"value":2842}," jwtSecret ",{"type":41,"tag":81,"props":2844,"children":2845},{"style":104},[2846],{"type":47,"value":451},{"type":41,"tag":81,"props":2848,"children":2849},{"style":454},[2850],{"type":47,"value":2798},{"type":41,"tag":81,"props":2852,"children":2853},{"style":110},[2854],{"type":47,"value":574},{"type":41,"tag":81,"props":2856,"children":2857},{"style":104},[2858],{"type":47,"value":149},{"type":41,"tag":81,"props":2860,"children":2861},{"style":141},[2862],{"type":47,"value":2863},"JWTSecret",{"type":41,"tag":81,"props":2865,"children":2866},{"style":104},[2867],{"type":47,"value":149},{"type":41,"tag":81,"props":2869,"children":2870},{"style":110},[2871],{"type":47,"value":508},{"type":41,"tag":81,"props":2873,"children":2874},{"style":104},[2875],{"type":47,"value":154},{"type":41,"tag":81,"props":2877,"children":2878},{"class":83,"line":25},[2879],{"type":41,"tag":81,"props":2880,"children":2881},{"emptyLinePlaceholder":203},[2882],{"type":47,"value":206},{"type":41,"tag":81,"props":2884,"children":2885},{"class":83,"line":217},[2886,2891,2896,2900,2904,2908,2912,2916,2921,2925,2929,2934,2938,2943,2947],{"type":41,"tag":81,"props":2887,"children":2888},{"style":221},[2889],{"type":47,"value":2890},"async",{"type":41,"tag":81,"props":2892,"children":2893},{"style":221},[2894],{"type":47,"value":2895}," function",{"type":41,"tag":81,"props":2897,"children":2898},{"style":454},[2899],{"type":47,"value":640},{"type":41,"tag":81,"props":2901,"children":2902},{"style":104},[2903],{"type":47,"value":574},{"type":41,"tag":81,"props":2905,"children":2906},{"style":500},[2907],{"type":47,"value":649},{"type":41,"tag":81,"props":2909,"children":2910},{"style":104},[2911],{"type":47,"value":250},{"type":41,"tag":81,"props":2913,"children":2914},{"style":227},[2915],{"type":47,"value":338},{"type":41,"tag":81,"props":2917,"children":2918},{"style":104},[2919],{"type":47,"value":2920},"):",{"type":41,"tag":81,"props":2922,"children":2923},{"style":227},[2924],{"type":47,"value":1191},{"type":41,"tag":81,"props":2926,"children":2927},{"style":104},[2928],{"type":47,"value":259},{"type":41,"tag":81,"props":2930,"children":2931},{"style":227},[2932],{"type":47,"value":2933},"JWTPayload",{"type":41,"tag":81,"props":2935,"children":2936},{"style":104},[2937],{"type":47,"value":394},{"type":41,"tag":81,"props":2939,"children":2940},{"style":227},[2941],{"type":47,"value":2942}," null",{"type":41,"tag":81,"props":2944,"children":2945},{"style":104},[2946],{"type":47,"value":478},{"type":41,"tag":81,"props":2948,"children":2949},{"style":104},[2950],{"type":47,"value":235},{"type":41,"tag":81,"props":2952,"children":2953},{"class":83,"line":238},[2954,2959],{"type":41,"tag":81,"props":2955,"children":2956},{"style":98},[2957],{"type":47,"value":2958},"  try",{"type":41,"tag":81,"props":2960,"children":2961},{"style":104},[2962],{"type":47,"value":235},{"type":41,"tag":81,"props":2964,"children":2965},{"class":83,"line":280},[2966,2970,2974,2978,2982,2986,2990,2994],{"type":41,"tag":81,"props":2967,"children":2968},{"style":221},[2969],{"type":47,"value":535},{"type":41,"tag":81,"props":2971,"children":2972},{"style":104},[2973],{"type":47,"value":107},{"type":41,"tag":81,"props":2975,"children":2976},{"style":110},[2977],{"type":47,"value":626},{"type":41,"tag":81,"props":2979,"children":2980},{"style":104},[2981],{"type":47,"value":128},{"type":41,"tag":81,"props":2983,"children":2984},{"style":104},[2985],{"type":47,"value":545},{"type":41,"tag":81,"props":2987,"children":2988},{"style":98},[2989],{"type":47,"value":635},{"type":41,"tag":81,"props":2991,"children":2992},{"style":454},[2993],{"type":47,"value":2757},{"type":41,"tag":81,"props":2995,"children":2996},{"style":242},[2997],{"type":47,"value":483},{"type":41,"tag":81,"props":2999,"children":3000},{"class":83,"line":289},[3001,3006],{"type":41,"tag":81,"props":3002,"children":3003},{"style":110},[3004],{"type":47,"value":3005},"      token",{"type":41,"tag":81,"props":3007,"children":3008},{"style":104},[3009],{"type":47,"value":798},{"type":41,"tag":81,"props":3011,"children":3012},{"class":83,"line":297},[3013,3018,3023,3027,3031,3036,3040,3045],{"type":41,"tag":81,"props":3014,"children":3015},{"style":104},[3016],{"type":47,"value":3017},"      new",{"type":41,"tag":81,"props":3019,"children":3020},{"style":454},[3021],{"type":47,"value":3022}," TextEncoder",{"type":41,"tag":81,"props":3024,"children":3025},{"style":242},[3026],{"type":47,"value":1693},{"type":41,"tag":81,"props":3028,"children":3029},{"style":104},[3030],{"type":47,"value":555},{"type":41,"tag":81,"props":3032,"children":3033},{"style":454},[3034],{"type":47,"value":3035},"encode",{"type":41,"tag":81,"props":3037,"children":3038},{"style":242},[3039],{"type":47,"value":574},{"type":41,"tag":81,"props":3041,"children":3042},{"style":454},[3043],{"type":47,"value":3044},"jwtSecret",{"type":41,"tag":81,"props":3046,"children":3047},{"style":242},[3048],{"type":47,"value":3049},"())\n",{"type":41,"tag":81,"props":3051,"children":3052},{"class":83,"line":306},[3053,3058],{"type":41,"tag":81,"props":3054,"children":3055},{"style":242},[3056],{"type":47,"value":3057},"    )",{"type":41,"tag":81,"props":3059,"children":3060},{"style":104},[3061],{"type":47,"value":154},{"type":41,"tag":81,"props":3063,"children":3064},{"class":83,"line":323},[3065,3069,3073],{"type":41,"tag":81,"props":3066,"children":3067},{"style":98},[3068],{"type":47,"value":763},{"type":41,"tag":81,"props":3070,"children":3071},{"style":110},[3072],{"type":47,"value":626},{"type":41,"tag":81,"props":3074,"children":3075},{"style":104},[3076],{"type":47,"value":154},{"type":41,"tag":81,"props":3078,"children":3079},{"class":83,"line":345},[3080,3085,3090],{"type":41,"tag":81,"props":3081,"children":3082},{"style":104},[3083],{"type":47,"value":3084},"  }",{"type":41,"tag":81,"props":3086,"children":3087},{"style":98},[3088],{"type":47,"value":3089}," catch",{"type":41,"tag":81,"props":3091,"children":3092},{"style":104},[3093],{"type":47,"value":235},{"type":41,"tag":81,"props":3095,"children":3096},{"class":83,"line":366},[3097,3101],{"type":41,"tag":81,"props":3098,"children":3099},{"style":98},[3100],{"type":47,"value":763},{"type":41,"tag":81,"props":3102,"children":3103},{"style":104},[3104],{"type":47,"value":3105}," null;\n",{"type":41,"tag":81,"props":3107,"children":3108},{"class":83,"line":414},[3109],{"type":41,"tag":81,"props":3110,"children":3111},{"style":104},[3112],{"type":47,"value":876},{"type":41,"tag":81,"props":3114,"children":3115},{"class":83,"line":422},[3116],{"type":41,"tag":81,"props":3117,"children":3118},{"style":104},[3119],{"type":47,"value":286},{"type":41,"tag":63,"props":3121,"children":3123},{"id":3122},"api-key-authentication",[3124],{"type":47,"value":3125},"API Key Authentication",{"type":41,"tag":70,"props":3127,"children":3129},{"className":72,"code":3128,"language":19,"meta":74,"style":74},"export const auth = authHandler\u003CAuthParams, AuthData>(\n  async (params) => {\n    const apiKey = params.authorization;\n    \n    const user = await db.queryRow\u003CUser>`\n      SELECT id, email, role FROM users WHERE api_key = ${apiKey}\n    `;\n    \n    if (!user) {\n      throw APIError.unauthenticated(\"invalid API key\");\n    }\n    \n    return {\n      userID: user.id,\n      email: user.email,\n      role: user.role,\n    };\n  }\n);\n",[3130],{"type":41,"tag":77,"props":3131,"children":3132},{"__ignoreMap":74},[3133,3180,3207,3239,3246,3297,3319,3331,3338,3365,3409,3416,3423,3434,3461,3488,3515,3522,3529],{"type":41,"tag":81,"props":3134,"children":3135},{"class":83,"line":84},[3136,3140,3144,3148,3152,3156,3160,3164,3168,3172,3176],{"type":41,"tag":81,"props":3137,"children":3138},{"style":98},[3139],{"type":47,"value":436},{"type":41,"tag":81,"props":3141,"children":3142},{"style":221},[3143],{"type":47,"value":441},{"type":41,"tag":81,"props":3145,"children":3146},{"style":110},[3147],{"type":47,"value":446},{"type":41,"tag":81,"props":3149,"children":3150},{"style":104},[3151],{"type":47,"value":451},{"type":41,"tag":81,"props":3153,"children":3154},{"style":454},[3155],{"type":47,"value":171},{"type":41,"tag":81,"props":3157,"children":3158},{"style":104},[3159],{"type":47,"value":259},{"type":41,"tag":81,"props":3161,"children":3162},{"style":227},[3163],{"type":47,"value":465},{"type":41,"tag":81,"props":3165,"children":3166},{"style":104},[3167],{"type":47,"value":118},{"type":41,"tag":81,"props":3169,"children":3170},{"style":227},[3171],{"type":47,"value":316},{"type":41,"tag":81,"props":3173,"children":3174},{"style":104},[3175],{"type":47,"value":478},{"type":41,"tag":81,"props":3177,"children":3178},{"style":110},[3179],{"type":47,"value":483},{"type":41,"tag":81,"props":3181,"children":3182},{"class":83,"line":94},[3183,3187,3191,3195,3199,3203],{"type":41,"tag":81,"props":3184,"children":3185},{"style":221},[3186],{"type":47,"value":492},{"type":41,"tag":81,"props":3188,"children":3189},{"style":104},[3190],{"type":47,"value":497},{"type":41,"tag":81,"props":3192,"children":3193},{"style":500},[3194],{"type":47,"value":503},{"type":41,"tag":81,"props":3196,"children":3197},{"style":104},[3198],{"type":47,"value":508},{"type":41,"tag":81,"props":3200,"children":3201},{"style":221},[3202],{"type":47,"value":513},{"type":41,"tag":81,"props":3204,"children":3205},{"style":104},[3206],{"type":47,"value":235},{"type":41,"tag":81,"props":3208,"children":3209},{"class":83,"line":157},[3210,3214,3219,3223,3227,3231,3235],{"type":41,"tag":81,"props":3211,"children":3212},{"style":221},[3213],{"type":47,"value":535},{"type":41,"tag":81,"props":3215,"children":3216},{"style":110},[3217],{"type":47,"value":3218}," apiKey",{"type":41,"tag":81,"props":3220,"children":3221},{"style":104},[3222],{"type":47,"value":545},{"type":41,"tag":81,"props":3224,"children":3225},{"style":110},[3226],{"type":47,"value":550},{"type":41,"tag":81,"props":3228,"children":3229},{"style":104},[3230],{"type":47,"value":555},{"type":41,"tag":81,"props":3232,"children":3233},{"style":110},[3234],{"type":47,"value":560},{"type":41,"tag":81,"props":3236,"children":3237},{"style":104},[3238],{"type":47,"value":154},{"type":41,"tag":81,"props":3240,"children":3241},{"class":83,"line":199},[3242],{"type":41,"tag":81,"props":3243,"children":3244},{"style":242},[3245],{"type":47,"value":613},{"type":41,"tag":81,"props":3247,"children":3248},{"class":83,"line":25},[3249,3253,3257,3261,3265,3270,3274,3279,3283,3288,3292],{"type":41,"tag":81,"props":3250,"children":3251},{"style":221},[3252],{"type":47,"value":535},{"type":41,"tag":81,"props":3254,"children":3255},{"style":110},[3256],{"type":47,"value":2086},{"type":41,"tag":81,"props":3258,"children":3259},{"style":104},[3260],{"type":47,"value":545},{"type":41,"tag":81,"props":3262,"children":3263},{"style":98},[3264],{"type":47,"value":635},{"type":41,"tag":81,"props":3266,"children":3267},{"style":110},[3268],{"type":47,"value":3269}," db",{"type":41,"tag":81,"props":3271,"children":3272},{"style":104},[3273],{"type":47,"value":555},{"type":41,"tag":81,"props":3275,"children":3276},{"style":454},[3277],{"type":47,"value":3278},"queryRow",{"type":41,"tag":81,"props":3280,"children":3281},{"style":104},[3282],{"type":47,"value":259},{"type":41,"tag":81,"props":3284,"children":3285},{"style":227},[3286],{"type":47,"value":3287},"User",{"type":41,"tag":81,"props":3289,"children":3290},{"style":104},[3291],{"type":47,"value":478},{"type":41,"tag":81,"props":3293,"children":3294},{"style":104},[3295],{"type":47,"value":3296},"`\n",{"type":41,"tag":81,"props":3298,"children":3299},{"class":83,"line":217},[3300,3305,3310,3315],{"type":41,"tag":81,"props":3301,"children":3302},{"style":141},[3303],{"type":47,"value":3304},"      SELECT id, email, role FROM users WHERE api_key = ",{"type":41,"tag":81,"props":3306,"children":3307},{"style":104},[3308],{"type":47,"value":3309},"${",{"type":41,"tag":81,"props":3311,"children":3312},{"style":110},[3313],{"type":47,"value":3314},"apiKey",{"type":41,"tag":81,"props":3316,"children":3317},{"style":104},[3318],{"type":47,"value":286},{"type":41,"tag":81,"props":3320,"children":3321},{"class":83,"line":238},[3322,3327],{"type":41,"tag":81,"props":3323,"children":3324},{"style":104},[3325],{"type":47,"value":3326},"    `",{"type":41,"tag":81,"props":3328,"children":3329},{"style":104},[3330],{"type":47,"value":154},{"type":41,"tag":81,"props":3332,"children":3333},{"class":83,"line":280},[3334],{"type":41,"tag":81,"props":3335,"children":3336},{"style":242},[3337],{"type":47,"value":613},{"type":41,"tag":81,"props":3339,"children":3340},{"class":83,"line":289},[3341,3345,3349,3353,3357,3361],{"type":41,"tag":81,"props":3342,"children":3343},{"style":98},[3344],{"type":47,"value":666},{"type":41,"tag":81,"props":3346,"children":3347},{"style":242},[3348],{"type":47,"value":497},{"type":41,"tag":81,"props":3350,"children":3351},{"style":104},[3352],{"type":47,"value":675},{"type":41,"tag":81,"props":3354,"children":3355},{"style":110},[3356],{"type":47,"value":403},{"type":41,"tag":81,"props":3358,"children":3359},{"style":242},[3360],{"type":47,"value":685},{"type":41,"tag":81,"props":3362,"children":3363},{"style":104},[3364],{"type":47,"value":690},{"type":41,"tag":81,"props":3366,"children":3367},{"class":83,"line":297},[3368,3372,3376,3380,3384,3388,3392,3397,3401,3405],{"type":41,"tag":81,"props":3369,"children":3370},{"style":98},[3371],{"type":47,"value":699},{"type":41,"tag":81,"props":3373,"children":3374},{"style":110},[3375],{"type":47,"value":704},{"type":41,"tag":81,"props":3377,"children":3378},{"style":104},[3379],{"type":47,"value":555},{"type":41,"tag":81,"props":3381,"children":3382},{"style":454},[3383],{"type":47,"value":713},{"type":41,"tag":81,"props":3385,"children":3386},{"style":242},[3387],{"type":47,"value":574},{"type":41,"tag":81,"props":3389,"children":3390},{"style":104},[3391],{"type":47,"value":149},{"type":41,"tag":81,"props":3393,"children":3394},{"style":141},[3395],{"type":47,"value":3396},"invalid API key",{"type":41,"tag":81,"props":3398,"children":3399},{"style":104},[3400],{"type":47,"value":149},{"type":41,"tag":81,"props":3402,"children":3403},{"style":242},[3404],{"type":47,"value":508},{"type":41,"tag":81,"props":3406,"children":3407},{"style":104},[3408],{"type":47,"value":154},{"type":41,"tag":81,"props":3410,"children":3411},{"class":83,"line":306},[3412],{"type":41,"tag":81,"props":3413,"children":3414},{"style":104},[3415],{"type":47,"value":747},{"type":41,"tag":81,"props":3417,"children":3418},{"class":83,"line":323},[3419],{"type":41,"tag":81,"props":3420,"children":3421},{"style":242},[3422],{"type":47,"value":613},{"type":41,"tag":81,"props":3424,"children":3425},{"class":83,"line":345},[3426,3430],{"type":41,"tag":81,"props":3427,"children":3428},{"style":98},[3429],{"type":47,"value":763},{"type":41,"tag":81,"props":3431,"children":3432},{"style":104},[3433],{"type":47,"value":235},{"type":41,"tag":81,"props":3435,"children":3436},{"class":83,"line":366},[3437,3441,3445,3449,3453,3457],{"type":41,"tag":81,"props":3438,"children":3439},{"style":242},[3440],{"type":47,"value":776},{"type":41,"tag":81,"props":3442,"children":3443},{"style":104},[3444],{"type":47,"value":250},{"type":41,"tag":81,"props":3446,"children":3447},{"style":110},[3448],{"type":47,"value":2086},{"type":41,"tag":81,"props":3450,"children":3451},{"style":104},[3452],{"type":47,"value":555},{"type":41,"tag":81,"props":3454,"children":3455},{"style":110},[3456],{"type":47,"value":2449},{"type":41,"tag":81,"props":3458,"children":3459},{"style":104},[3460],{"type":47,"value":798},{"type":41,"tag":81,"props":3462,"children":3463},{"class":83,"line":414},[3464,3468,3472,3476,3480,3484],{"type":41,"tag":81,"props":3465,"children":3466},{"style":242},[3467],{"type":47,"value":807},{"type":41,"tag":81,"props":3469,"children":3470},{"style":104},[3471],{"type":47,"value":250},{"type":41,"tag":81,"props":3473,"children":3474},{"style":110},[3475],{"type":47,"value":2086},{"type":41,"tag":81,"props":3477,"children":3478},{"style":104},[3479],{"type":47,"value":555},{"type":41,"tag":81,"props":3481,"children":3482},{"style":110},[3483],{"type":47,"value":824},{"type":41,"tag":81,"props":3485,"children":3486},{"style":104},[3487],{"type":47,"value":798},{"type":41,"tag":81,"props":3489,"children":3490},{"class":83,"line":422},[3491,3495,3499,3503,3507,3511],{"type":41,"tag":81,"props":3492,"children":3493},{"style":242},[3494],{"type":47,"value":837},{"type":41,"tag":81,"props":3496,"children":3497},{"style":104},[3498],{"type":47,"value":250},{"type":41,"tag":81,"props":3500,"children":3501},{"style":110},[3502],{"type":47,"value":2086},{"type":41,"tag":81,"props":3504,"children":3505},{"style":104},[3506],{"type":47,"value":555},{"type":41,"tag":81,"props":3508,"children":3509},{"style":110},[3510],{"type":47,"value":854},{"type":41,"tag":81,"props":3512,"children":3513},{"style":104},[3514],{"type":47,"value":798},{"type":41,"tag":81,"props":3516,"children":3517},{"class":83,"line":430},[3518],{"type":41,"tag":81,"props":3519,"children":3520},{"style":104},[3521],{"type":47,"value":867},{"type":41,"tag":81,"props":3523,"children":3524},{"class":83,"line":486},[3525],{"type":41,"tag":81,"props":3526,"children":3527},{"style":104},[3528],{"type":47,"value":876},{"type":41,"tag":81,"props":3530,"children":3531},{"class":83,"line":520},[3532,3536],{"type":41,"tag":81,"props":3533,"children":3534},{"style":110},[3535],{"type":47,"value":508},{"type":41,"tag":81,"props":3537,"children":3538},{"style":104},[3539],{"type":47,"value":154},{"type":41,"tag":63,"props":3541,"children":3543},{"id":3542},"cookie-based-auth",[3544],{"type":47,"value":3545},"Cookie-Based Auth",{"type":41,"tag":70,"props":3547,"children":3549},{"className":72,"code":3548,"language":19,"meta":74,"style":74},"interface AuthParams {\n  cookie: Header\u003C\"Cookie\">;\n}\n\nexport const auth = authHandler\u003CAuthParams, AuthData>(\n  async (params) => {\n    const sessionId = parseCookie(params.cookie, \"session\");\n    \n    if (!sessionId) {\n      throw APIError.unauthenticated(\"no session\");\n    }\n    \n    const session = await getSession(sessionId);\n    if (!session || session.expiresAt \u003C new Date()) {\n      throw APIError.unauthenticated(\"session expired\");\n    }\n    \n    return {\n      userID: session.userID,\n      email: session.email,\n      role: session.role,\n    };\n  }\n);\n",[3550],{"type":41,"tag":77,"props":3551,"children":3552},{"__ignoreMap":74},[3553,3568,3605,3612,3619,3666,3693,3756,3763,3791,3835,3842,3849,3890,3950,3994,4001,4008,4019,4046,4073,4100,4107,4114],{"type":41,"tag":81,"props":3554,"children":3555},{"class":83,"line":84},[3556,3560,3564],{"type":41,"tag":81,"props":3557,"children":3558},{"style":221},[3559],{"type":47,"value":224},{"type":41,"tag":81,"props":3561,"children":3562},{"style":227},[3563],{"type":47,"value":230},{"type":41,"tag":81,"props":3565,"children":3566},{"style":104},[3567],{"type":47,"value":235},{"type":41,"tag":81,"props":3569,"children":3570},{"class":83,"line":94},[3571,3576,3580,3584,3588,3592,3597,3601],{"type":41,"tag":81,"props":3572,"children":3573},{"style":242},[3574],{"type":47,"value":3575},"  cookie",{"type":41,"tag":81,"props":3577,"children":3578},{"style":104},[3579],{"type":47,"value":250},{"type":41,"tag":81,"props":3581,"children":3582},{"style":227},[3583],{"type":47,"value":113},{"type":41,"tag":81,"props":3585,"children":3586},{"style":104},[3587],{"type":47,"value":259},{"type":41,"tag":81,"props":3589,"children":3590},{"style":104},[3591],{"type":47,"value":149},{"type":41,"tag":81,"props":3593,"children":3594},{"style":141},[3595],{"type":47,"value":3596},"Cookie",{"type":41,"tag":81,"props":3598,"children":3599},{"style":104},[3600],{"type":47,"value":149},{"type":41,"tag":81,"props":3602,"children":3603},{"style":104},[3604],{"type":47,"value":277},{"type":41,"tag":81,"props":3606,"children":3607},{"class":83,"line":157},[3608],{"type":41,"tag":81,"props":3609,"children":3610},{"style":104},[3611],{"type":47,"value":286},{"type":41,"tag":81,"props":3613,"children":3614},{"class":83,"line":199},[3615],{"type":41,"tag":81,"props":3616,"children":3617},{"emptyLinePlaceholder":203},[3618],{"type":47,"value":206},{"type":41,"tag":81,"props":3620,"children":3621},{"class":83,"line":25},[3622,3626,3630,3634,3638,3642,3646,3650,3654,3658,3662],{"type":41,"tag":81,"props":3623,"children":3624},{"style":98},[3625],{"type":47,"value":436},{"type":41,"tag":81,"props":3627,"children":3628},{"style":221},[3629],{"type":47,"value":441},{"type":41,"tag":81,"props":3631,"children":3632},{"style":110},[3633],{"type":47,"value":446},{"type":41,"tag":81,"props":3635,"children":3636},{"style":104},[3637],{"type":47,"value":451},{"type":41,"tag":81,"props":3639,"children":3640},{"style":454},[3641],{"type":47,"value":171},{"type":41,"tag":81,"props":3643,"children":3644},{"style":104},[3645],{"type":47,"value":259},{"type":41,"tag":81,"props":3647,"children":3648},{"style":227},[3649],{"type":47,"value":465},{"type":41,"tag":81,"props":3651,"children":3652},{"style":104},[3653],{"type":47,"value":118},{"type":41,"tag":81,"props":3655,"children":3656},{"style":227},[3657],{"type":47,"value":316},{"type":41,"tag":81,"props":3659,"children":3660},{"style":104},[3661],{"type":47,"value":478},{"type":41,"tag":81,"props":3663,"children":3664},{"style":110},[3665],{"type":47,"value":483},{"type":41,"tag":81,"props":3667,"children":3668},{"class":83,"line":217},[3669,3673,3677,3681,3685,3689],{"type":41,"tag":81,"props":3670,"children":3671},{"style":221},[3672],{"type":47,"value":492},{"type":41,"tag":81,"props":3674,"children":3675},{"style":104},[3676],{"type":47,"value":497},{"type":41,"tag":81,"props":3678,"children":3679},{"style":500},[3680],{"type":47,"value":503},{"type":41,"tag":81,"props":3682,"children":3683},{"style":104},[3684],{"type":47,"value":508},{"type":41,"tag":81,"props":3686,"children":3687},{"style":221},[3688],{"type":47,"value":513},{"type":41,"tag":81,"props":3690,"children":3691},{"style":104},[3692],{"type":47,"value":235},{"type":41,"tag":81,"props":3694,"children":3695},{"class":83,"line":238},[3696,3700,3705,3709,3714,3718,3722,3726,3731,3735,3739,3744,3748,3752],{"type":41,"tag":81,"props":3697,"children":3698},{"style":221},[3699],{"type":47,"value":535},{"type":41,"tag":81,"props":3701,"children":3702},{"style":110},[3703],{"type":47,"value":3704}," sessionId",{"type":41,"tag":81,"props":3706,"children":3707},{"style":104},[3708],{"type":47,"value":545},{"type":41,"tag":81,"props":3710,"children":3711},{"style":454},[3712],{"type":47,"value":3713}," parseCookie",{"type":41,"tag":81,"props":3715,"children":3716},{"style":242},[3717],{"type":47,"value":574},{"type":41,"tag":81,"props":3719,"children":3720},{"style":110},[3721],{"type":47,"value":503},{"type":41,"tag":81,"props":3723,"children":3724},{"style":104},[3725],{"type":47,"value":555},{"type":41,"tag":81,"props":3727,"children":3728},{"style":110},[3729],{"type":47,"value":3730},"cookie",{"type":41,"tag":81,"props":3732,"children":3733},{"style":104},[3734],{"type":47,"value":118},{"type":41,"tag":81,"props":3736,"children":3737},{"style":104},[3738],{"type":47,"value":138},{"type":41,"tag":81,"props":3740,"children":3741},{"style":141},[3742],{"type":47,"value":3743},"session",{"type":41,"tag":81,"props":3745,"children":3746},{"style":104},[3747],{"type":47,"value":149},{"type":41,"tag":81,"props":3749,"children":3750},{"style":242},[3751],{"type":47,"value":508},{"type":41,"tag":81,"props":3753,"children":3754},{"style":104},[3755],{"type":47,"value":154},{"type":41,"tag":81,"props":3757,"children":3758},{"class":83,"line":280},[3759],{"type":41,"tag":81,"props":3760,"children":3761},{"style":242},[3762],{"type":47,"value":613},{"type":41,"tag":81,"props":3764,"children":3765},{"class":83,"line":289},[3766,3770,3774,3778,3783,3787],{"type":41,"tag":81,"props":3767,"children":3768},{"style":98},[3769],{"type":47,"value":666},{"type":41,"tag":81,"props":3771,"children":3772},{"style":242},[3773],{"type":47,"value":497},{"type":41,"tag":81,"props":3775,"children":3776},{"style":104},[3777],{"type":47,"value":675},{"type":41,"tag":81,"props":3779,"children":3780},{"style":110},[3781],{"type":47,"value":3782},"sessionId",{"type":41,"tag":81,"props":3784,"children":3785},{"style":242},[3786],{"type":47,"value":685},{"type":41,"tag":81,"props":3788,"children":3789},{"style":104},[3790],{"type":47,"value":690},{"type":41,"tag":81,"props":3792,"children":3793},{"class":83,"line":297},[3794,3798,3802,3806,3810,3814,3818,3823,3827,3831],{"type":41,"tag":81,"props":3795,"children":3796},{"style":98},[3797],{"type":47,"value":699},{"type":41,"tag":81,"props":3799,"children":3800},{"style":110},[3801],{"type":47,"value":704},{"type":41,"tag":81,"props":3803,"children":3804},{"style":104},[3805],{"type":47,"value":555},{"type":41,"tag":81,"props":3807,"children":3808},{"style":454},[3809],{"type":47,"value":713},{"type":41,"tag":81,"props":3811,"children":3812},{"style":242},[3813],{"type":47,"value":574},{"type":41,"tag":81,"props":3815,"children":3816},{"style":104},[3817],{"type":47,"value":149},{"type":41,"tag":81,"props":3819,"children":3820},{"style":141},[3821],{"type":47,"value":3822},"no session",{"type":41,"tag":81,"props":3824,"children":3825},{"style":104},[3826],{"type":47,"value":149},{"type":41,"tag":81,"props":3828,"children":3829},{"style":242},[3830],{"type":47,"value":508},{"type":41,"tag":81,"props":3832,"children":3833},{"style":104},[3834],{"type":47,"value":154},{"type":41,"tag":81,"props":3836,"children":3837},{"class":83,"line":306},[3838],{"type":41,"tag":81,"props":3839,"children":3840},{"style":104},[3841],{"type":47,"value":747},{"type":41,"tag":81,"props":3843,"children":3844},{"class":83,"line":323},[3845],{"type":41,"tag":81,"props":3846,"children":3847},{"style":242},[3848],{"type":47,"value":613},{"type":41,"tag":81,"props":3850,"children":3851},{"class":83,"line":345},[3852,3856,3861,3865,3869,3874,3878,3882,3886],{"type":41,"tag":81,"props":3853,"children":3854},{"style":221},[3855],{"type":47,"value":535},{"type":41,"tag":81,"props":3857,"children":3858},{"style":110},[3859],{"type":47,"value":3860}," session",{"type":41,"tag":81,"props":3862,"children":3863},{"style":104},[3864],{"type":47,"value":545},{"type":41,"tag":81,"props":3866,"children":3867},{"style":98},[3868],{"type":47,"value":635},{"type":41,"tag":81,"props":3870,"children":3871},{"style":454},[3872],{"type":47,"value":3873}," getSession",{"type":41,"tag":81,"props":3875,"children":3876},{"style":242},[3877],{"type":47,"value":574},{"type":41,"tag":81,"props":3879,"children":3880},{"style":110},[3881],{"type":47,"value":3782},{"type":41,"tag":81,"props":3883,"children":3884},{"style":242},[3885],{"type":47,"value":508},{"type":41,"tag":81,"props":3887,"children":3888},{"style":104},[3889],{"type":47,"value":154},{"type":41,"tag":81,"props":3891,"children":3892},{"class":83,"line":366},[3893,3897,3901,3905,3909,3914,3918,3922,3927,3932,3936,3941,3946],{"type":41,"tag":81,"props":3894,"children":3895},{"style":98},[3896],{"type":47,"value":666},{"type":41,"tag":81,"props":3898,"children":3899},{"style":242},[3900],{"type":47,"value":497},{"type":41,"tag":81,"props":3902,"children":3903},{"style":104},[3904],{"type":47,"value":675},{"type":41,"tag":81,"props":3906,"children":3907},{"style":110},[3908],{"type":47,"value":3743},{"type":41,"tag":81,"props":3910,"children":3911},{"style":104},[3912],{"type":47,"value":3913}," ||",{"type":41,"tag":81,"props":3915,"children":3916},{"style":110},[3917],{"type":47,"value":3860},{"type":41,"tag":81,"props":3919,"children":3920},{"style":104},[3921],{"type":47,"value":555},{"type":41,"tag":81,"props":3923,"children":3924},{"style":110},[3925],{"type":47,"value":3926},"expiresAt",{"type":41,"tag":81,"props":3928,"children":3929},{"style":104},[3930],{"type":47,"value":3931}," \u003C",{"type":41,"tag":81,"props":3933,"children":3934},{"style":104},[3935],{"type":47,"value":931},{"type":41,"tag":81,"props":3937,"children":3938},{"style":454},[3939],{"type":47,"value":3940}," Date",{"type":41,"tag":81,"props":3942,"children":3943},{"style":242},[3944],{"type":47,"value":3945},"()) ",{"type":41,"tag":81,"props":3947,"children":3948},{"style":104},[3949],{"type":47,"value":690},{"type":41,"tag":81,"props":3951,"children":3952},{"class":83,"line":414},[3953,3957,3961,3965,3969,3973,3977,3982,3986,3990],{"type":41,"tag":81,"props":3954,"children":3955},{"style":98},[3956],{"type":47,"value":699},{"type":41,"tag":81,"props":3958,"children":3959},{"style":110},[3960],{"type":47,"value":704},{"type":41,"tag":81,"props":3962,"children":3963},{"style":104},[3964],{"type":47,"value":555},{"type":41,"tag":81,"props":3966,"children":3967},{"style":454},[3968],{"type":47,"value":713},{"type":41,"tag":81,"props":3970,"children":3971},{"style":242},[3972],{"type":47,"value":574},{"type":41,"tag":81,"props":3974,"children":3975},{"style":104},[3976],{"type":47,"value":149},{"type":41,"tag":81,"props":3978,"children":3979},{"style":141},[3980],{"type":47,"value":3981},"session expired",{"type":41,"tag":81,"props":3983,"children":3984},{"style":104},[3985],{"type":47,"value":149},{"type":41,"tag":81,"props":3987,"children":3988},{"style":242},[3989],{"type":47,"value":508},{"type":41,"tag":81,"props":3991,"children":3992},{"style":104},[3993],{"type":47,"value":154},{"type":41,"tag":81,"props":3995,"children":3996},{"class":83,"line":422},[3997],{"type":41,"tag":81,"props":3998,"children":3999},{"style":104},[4000],{"type":47,"value":747},{"type":41,"tag":81,"props":4002,"children":4003},{"class":83,"line":430},[4004],{"type":41,"tag":81,"props":4005,"children":4006},{"style":242},[4007],{"type":47,"value":613},{"type":41,"tag":81,"props":4009,"children":4010},{"class":83,"line":486},[4011,4015],{"type":41,"tag":81,"props":4012,"children":4013},{"style":98},[4014],{"type":47,"value":763},{"type":41,"tag":81,"props":4016,"children":4017},{"style":104},[4018],{"type":47,"value":235},{"type":41,"tag":81,"props":4020,"children":4021},{"class":83,"line":520},[4022,4026,4030,4034,4038,4042],{"type":41,"tag":81,"props":4023,"children":4024},{"style":242},[4025],{"type":47,"value":776},{"type":41,"tag":81,"props":4027,"children":4028},{"style":104},[4029],{"type":47,"value":250},{"type":41,"tag":81,"props":4031,"children":4032},{"style":110},[4033],{"type":47,"value":3860},{"type":41,"tag":81,"props":4035,"children":4036},{"style":104},[4037],{"type":47,"value":555},{"type":41,"tag":81,"props":4039,"children":4040},{"style":110},[4041],{"type":47,"value":1745},{"type":41,"tag":81,"props":4043,"children":4044},{"style":104},[4045],{"type":47,"value":798},{"type":41,"tag":81,"props":4047,"children":4048},{"class":83,"line":529},[4049,4053,4057,4061,4065,4069],{"type":41,"tag":81,"props":4050,"children":4051},{"style":242},[4052],{"type":47,"value":807},{"type":41,"tag":81,"props":4054,"children":4055},{"style":104},[4056],{"type":47,"value":250},{"type":41,"tag":81,"props":4058,"children":4059},{"style":110},[4060],{"type":47,"value":3860},{"type":41,"tag":81,"props":4062,"children":4063},{"style":104},[4064],{"type":47,"value":555},{"type":41,"tag":81,"props":4066,"children":4067},{"style":110},[4068],{"type":47,"value":824},{"type":41,"tag":81,"props":4070,"children":4071},{"style":104},[4072],{"type":47,"value":798},{"type":41,"tag":81,"props":4074,"children":4075},{"class":83,"line":607},[4076,4080,4084,4088,4092,4096],{"type":41,"tag":81,"props":4077,"children":4078},{"style":242},[4079],{"type":47,"value":837},{"type":41,"tag":81,"props":4081,"children":4082},{"style":104},[4083],{"type":47,"value":250},{"type":41,"tag":81,"props":4085,"children":4086},{"style":110},[4087],{"type":47,"value":3860},{"type":41,"tag":81,"props":4089,"children":4090},{"style":104},[4091],{"type":47,"value":555},{"type":41,"tag":81,"props":4093,"children":4094},{"style":110},[4095],{"type":47,"value":854},{"type":41,"tag":81,"props":4097,"children":4098},{"style":104},[4099],{"type":47,"value":798},{"type":41,"tag":81,"props":4101,"children":4102},{"class":83,"line":616},[4103],{"type":41,"tag":81,"props":4104,"children":4105},{"style":104},[4106],{"type":47,"value":867},{"type":41,"tag":81,"props":4108,"children":4109},{"class":83,"line":660},[4110],{"type":41,"tag":81,"props":4111,"children":4112},{"style":104},[4113],{"type":47,"value":876},{"type":41,"tag":81,"props":4115,"children":4116},{"class":83,"line":693},[4117,4121],{"type":41,"tag":81,"props":4118,"children":4119},{"style":110},[4120],{"type":47,"value":508},{"type":41,"tag":81,"props":4122,"children":4123},{"style":104},[4124],{"type":47,"value":154},{"type":41,"tag":50,"props":4126,"children":4128},{"id":4127},"testing-with-auth",[4129],{"type":47,"value":4130},"Testing with Auth",{"type":41,"tag":57,"props":4132,"children":4133},{},[4134],{"type":47,"value":4135},"Mock authentication in tests using Vitest:",{"type":41,"tag":70,"props":4137,"children":4139},{"className":72,"code":4138,"language":19,"meta":74,"style":74},"import { describe, it, expect, vi } from \"vitest\";\nimport * as auth from \"~encore\u002Fauth\";\nimport { getProfile } from \".\u002Fapi\";\n\ndescribe(\"authenticated endpoints\", () => {\n  it(\"returns profile for authenticated user\", async () => {\n    \u002F\u002F Mock getAuthData to return test user\n    const spy = vi.spyOn(auth, \"getAuthData\");\n    spy.mockImplementation(() => ({\n      userID: \"test-user-123\",\n      email: \"test@example.com\",\n      role: \"user\",\n    }));\n\n    const profile = await getProfile();\n    expect(profile.email).toBe(\"test@example.com\");\n\n    spy.mockRestore();\n  });\n});\n",[4140],{"type":41,"tag":77,"props":4141,"children":4142},{"__ignoreMap":74},[4143,4211,4253,4294,4301,4342,4388,4396,4458,4495,4523,4551,4578,4595,4602,4634,4696,4703,4727,4742],{"type":41,"tag":81,"props":4144,"children":4145},{"class":83,"line":84},[4146,4150,4154,4159,4163,4168,4172,4177,4181,4186,4190,4194,4198,4203,4207],{"type":41,"tag":81,"props":4147,"children":4148},{"style":98},[4149],{"type":47,"value":101},{"type":41,"tag":81,"props":4151,"children":4152},{"style":104},[4153],{"type":47,"value":107},{"type":41,"tag":81,"props":4155,"children":4156},{"style":110},[4157],{"type":47,"value":4158}," describe",{"type":41,"tag":81,"props":4160,"children":4161},{"style":104},[4162],{"type":47,"value":118},{"type":41,"tag":81,"props":4164,"children":4165},{"style":110},[4166],{"type":47,"value":4167}," it",{"type":41,"tag":81,"props":4169,"children":4170},{"style":104},[4171],{"type":47,"value":118},{"type":41,"tag":81,"props":4173,"children":4174},{"style":110},[4175],{"type":47,"value":4176}," expect",{"type":41,"tag":81,"props":4178,"children":4179},{"style":104},[4180],{"type":47,"value":118},{"type":41,"tag":81,"props":4182,"children":4183},{"style":110},[4184],{"type":47,"value":4185}," vi",{"type":41,"tag":81,"props":4187,"children":4188},{"style":104},[4189],{"type":47,"value":128},{"type":41,"tag":81,"props":4191,"children":4192},{"style":98},[4193],{"type":47,"value":133},{"type":41,"tag":81,"props":4195,"children":4196},{"style":104},[4197],{"type":47,"value":138},{"type":41,"tag":81,"props":4199,"children":4200},{"style":141},[4201],{"type":47,"value":4202},"vitest",{"type":41,"tag":81,"props":4204,"children":4205},{"style":104},[4206],{"type":47,"value":149},{"type":41,"tag":81,"props":4208,"children":4209},{"style":104},[4210],{"type":47,"value":154},{"type":41,"tag":81,"props":4212,"children":4213},{"class":83,"line":94},[4214,4218,4223,4228,4232,4237,4241,4245,4249],{"type":41,"tag":81,"props":4215,"children":4216},{"style":98},[4217],{"type":47,"value":101},{"type":41,"tag":81,"props":4219,"children":4220},{"style":104},[4221],{"type":47,"value":4222}," *",{"type":41,"tag":81,"props":4224,"children":4225},{"style":98},[4226],{"type":47,"value":4227}," as",{"type":41,"tag":81,"props":4229,"children":4230},{"style":110},[4231],{"type":47,"value":446},{"type":41,"tag":81,"props":4233,"children":4234},{"style":98},[4235],{"type":47,"value":4236},"from",{"type":41,"tag":81,"props":4238,"children":4239},{"style":104},[4240],{"type":47,"value":138},{"type":41,"tag":81,"props":4242,"children":4243},{"style":141},[4244],{"type":47,"value":1505},{"type":41,"tag":81,"props":4246,"children":4247},{"style":104},[4248],{"type":47,"value":149},{"type":41,"tag":81,"props":4250,"children":4251},{"style":104},[4252],{"type":47,"value":154},{"type":41,"tag":81,"props":4254,"children":4255},{"class":83,"line":157},[4256,4260,4264,4269,4273,4277,4281,4286,4290],{"type":41,"tag":81,"props":4257,"children":4258},{"style":98},[4259],{"type":47,"value":101},{"type":41,"tag":81,"props":4261,"children":4262},{"style":104},[4263],{"type":47,"value":107},{"type":41,"tag":81,"props":4265,"children":4266},{"style":110},[4267],{"type":47,"value":4268}," getProfile",{"type":41,"tag":81,"props":4270,"children":4271},{"style":104},[4272],{"type":47,"value":128},{"type":41,"tag":81,"props":4274,"children":4275},{"style":98},[4276],{"type":47,"value":133},{"type":41,"tag":81,"props":4278,"children":4279},{"style":104},[4280],{"type":47,"value":138},{"type":41,"tag":81,"props":4282,"children":4283},{"style":141},[4284],{"type":47,"value":4285},".\u002Fapi",{"type":41,"tag":81,"props":4287,"children":4288},{"style":104},[4289],{"type":47,"value":149},{"type":41,"tag":81,"props":4291,"children":4292},{"style":104},[4293],{"type":47,"value":154},{"type":41,"tag":81,"props":4295,"children":4296},{"class":83,"line":199},[4297],{"type":41,"tag":81,"props":4298,"children":4299},{"emptyLinePlaceholder":203},[4300],{"type":47,"value":206},{"type":41,"tag":81,"props":4302,"children":4303},{"class":83,"line":25},[4304,4309,4313,4317,4322,4326,4330,4334,4338],{"type":41,"tag":81,"props":4305,"children":4306},{"style":454},[4307],{"type":47,"value":4308},"describe",{"type":41,"tag":81,"props":4310,"children":4311},{"style":110},[4312],{"type":47,"value":574},{"type":41,"tag":81,"props":4314,"children":4315},{"style":104},[4316],{"type":47,"value":149},{"type":41,"tag":81,"props":4318,"children":4319},{"style":141},[4320],{"type":47,"value":4321},"authenticated endpoints",{"type":41,"tag":81,"props":4323,"children":4324},{"style":104},[4325],{"type":47,"value":149},{"type":41,"tag":81,"props":4327,"children":4328},{"style":104},[4329],{"type":47,"value":118},{"type":41,"tag":81,"props":4331,"children":4332},{"style":104},[4333],{"type":47,"value":1365},{"type":41,"tag":81,"props":4335,"children":4336},{"style":221},[4337],{"type":47,"value":513},{"type":41,"tag":81,"props":4339,"children":4340},{"style":104},[4341],{"type":47,"value":235},{"type":41,"tag":81,"props":4343,"children":4344},{"class":83,"line":217},[4345,4350,4354,4358,4363,4367,4371,4376,4380,4384],{"type":41,"tag":81,"props":4346,"children":4347},{"style":454},[4348],{"type":47,"value":4349},"  it",{"type":41,"tag":81,"props":4351,"children":4352},{"style":242},[4353],{"type":47,"value":574},{"type":41,"tag":81,"props":4355,"children":4356},{"style":104},[4357],{"type":47,"value":149},{"type":41,"tag":81,"props":4359,"children":4360},{"style":141},[4361],{"type":47,"value":4362},"returns profile for authenticated user",{"type":41,"tag":81,"props":4364,"children":4365},{"style":104},[4366],{"type":47,"value":149},{"type":41,"tag":81,"props":4368,"children":4369},{"style":104},[4370],{"type":47,"value":118},{"type":41,"tag":81,"props":4372,"children":4373},{"style":221},[4374],{"type":47,"value":4375}," async",{"type":41,"tag":81,"props":4377,"children":4378},{"style":104},[4379],{"type":47,"value":1365},{"type":41,"tag":81,"props":4381,"children":4382},{"style":221},[4383],{"type":47,"value":513},{"type":41,"tag":81,"props":4385,"children":4386},{"style":104},[4387],{"type":47,"value":235},{"type":41,"tag":81,"props":4389,"children":4390},{"class":83,"line":238},[4391],{"type":41,"tag":81,"props":4392,"children":4393},{"style":88},[4394],{"type":47,"value":4395},"    \u002F\u002F Mock getAuthData to return test user\n",{"type":41,"tag":81,"props":4397,"children":4398},{"class":83,"line":280},[4399,4403,4408,4412,4416,4420,4425,4429,4433,4437,4441,4446,4450,4454],{"type":41,"tag":81,"props":4400,"children":4401},{"style":221},[4402],{"type":47,"value":535},{"type":41,"tag":81,"props":4404,"children":4405},{"style":110},[4406],{"type":47,"value":4407}," spy",{"type":41,"tag":81,"props":4409,"children":4410},{"style":104},[4411],{"type":47,"value":545},{"type":41,"tag":81,"props":4413,"children":4414},{"style":110},[4415],{"type":47,"value":4185},{"type":41,"tag":81,"props":4417,"children":4418},{"style":104},[4419],{"type":47,"value":555},{"type":41,"tag":81,"props":4421,"children":4422},{"style":454},[4423],{"type":47,"value":4424},"spyOn",{"type":41,"tag":81,"props":4426,"children":4427},{"style":242},[4428],{"type":47,"value":574},{"type":41,"tag":81,"props":4430,"children":4431},{"style":110},[4432],{"type":47,"value":15},{"type":41,"tag":81,"props":4434,"children":4435},{"style":104},[4436],{"type":47,"value":118},{"type":41,"tag":81,"props":4438,"children":4439},{"style":104},[4440],{"type":47,"value":138},{"type":41,"tag":81,"props":4442,"children":4443},{"style":141},[4444],{"type":47,"value":4445},"getAuthData",{"type":41,"tag":81,"props":4447,"children":4448},{"style":104},[4449],{"type":47,"value":149},{"type":41,"tag":81,"props":4451,"children":4452},{"style":242},[4453],{"type":47,"value":508},{"type":41,"tag":81,"props":4455,"children":4456},{"style":104},[4457],{"type":47,"value":154},{"type":41,"tag":81,"props":4459,"children":4460},{"class":83,"line":289},[4461,4466,4470,4475,4479,4483,4487,4491],{"type":41,"tag":81,"props":4462,"children":4463},{"style":110},[4464],{"type":47,"value":4465},"    spy",{"type":41,"tag":81,"props":4467,"children":4468},{"style":104},[4469],{"type":47,"value":555},{"type":41,"tag":81,"props":4471,"children":4472},{"style":454},[4473],{"type":47,"value":4474},"mockImplementation",{"type":41,"tag":81,"props":4476,"children":4477},{"style":242},[4478],{"type":47,"value":574},{"type":41,"tag":81,"props":4480,"children":4481},{"style":104},[4482],{"type":47,"value":1693},{"type":41,"tag":81,"props":4484,"children":4485},{"style":221},[4486],{"type":47,"value":513},{"type":41,"tag":81,"props":4488,"children":4489},{"style":242},[4490],{"type":47,"value":497},{"type":41,"tag":81,"props":4492,"children":4493},{"style":104},[4494],{"type":47,"value":690},{"type":41,"tag":81,"props":4496,"children":4497},{"class":83,"line":297},[4498,4502,4506,4510,4515,4519],{"type":41,"tag":81,"props":4499,"children":4500},{"style":242},[4501],{"type":47,"value":776},{"type":41,"tag":81,"props":4503,"children":4504},{"style":104},[4505],{"type":47,"value":250},{"type":41,"tag":81,"props":4507,"children":4508},{"style":104},[4509],{"type":47,"value":138},{"type":41,"tag":81,"props":4511,"children":4512},{"style":141},[4513],{"type":47,"value":4514},"test-user-123",{"type":41,"tag":81,"props":4516,"children":4517},{"style":104},[4518],{"type":47,"value":149},{"type":41,"tag":81,"props":4520,"children":4521},{"style":104},[4522],{"type":47,"value":798},{"type":41,"tag":81,"props":4524,"children":4525},{"class":83,"line":306},[4526,4530,4534,4538,4543,4547],{"type":41,"tag":81,"props":4527,"children":4528},{"style":242},[4529],{"type":47,"value":807},{"type":41,"tag":81,"props":4531,"children":4532},{"style":104},[4533],{"type":47,"value":250},{"type":41,"tag":81,"props":4535,"children":4536},{"style":104},[4537],{"type":47,"value":138},{"type":41,"tag":81,"props":4539,"children":4540},{"style":141},[4541],{"type":47,"value":4542},"test@example.com",{"type":41,"tag":81,"props":4544,"children":4545},{"style":104},[4546],{"type":47,"value":149},{"type":41,"tag":81,"props":4548,"children":4549},{"style":104},[4550],{"type":47,"value":798},{"type":41,"tag":81,"props":4552,"children":4553},{"class":83,"line":323},[4554,4558,4562,4566,4570,4574],{"type":41,"tag":81,"props":4555,"children":4556},{"style":242},[4557],{"type":47,"value":837},{"type":41,"tag":81,"props":4559,"children":4560},{"style":104},[4561],{"type":47,"value":250},{"type":41,"tag":81,"props":4563,"children":4564},{"style":104},[4565],{"type":47,"value":138},{"type":41,"tag":81,"props":4567,"children":4568},{"style":141},[4569],{"type":47,"value":403},{"type":41,"tag":81,"props":4571,"children":4572},{"style":104},[4573],{"type":47,"value":149},{"type":41,"tag":81,"props":4575,"children":4576},{"style":104},[4577],{"type":47,"value":798},{"type":41,"tag":81,"props":4579,"children":4580},{"class":83,"line":345},[4581,4586,4591],{"type":41,"tag":81,"props":4582,"children":4583},{"style":104},[4584],{"type":47,"value":4585},"    }",{"type":41,"tag":81,"props":4587,"children":4588},{"style":242},[4589],{"type":47,"value":4590},"))",{"type":41,"tag":81,"props":4592,"children":4593},{"style":104},[4594],{"type":47,"value":154},{"type":41,"tag":81,"props":4596,"children":4597},{"class":83,"line":366},[4598],{"type":41,"tag":81,"props":4599,"children":4600},{"emptyLinePlaceholder":203},[4601],{"type":47,"value":206},{"type":41,"tag":81,"props":4603,"children":4604},{"class":83,"line":414},[4605,4609,4614,4618,4622,4626,4630],{"type":41,"tag":81,"props":4606,"children":4607},{"style":221},[4608],{"type":47,"value":535},{"type":41,"tag":81,"props":4610,"children":4611},{"style":110},[4612],{"type":47,"value":4613}," profile",{"type":41,"tag":81,"props":4615,"children":4616},{"style":104},[4617],{"type":47,"value":545},{"type":41,"tag":81,"props":4619,"children":4620},{"style":98},[4621],{"type":47,"value":635},{"type":41,"tag":81,"props":4623,"children":4624},{"style":454},[4625],{"type":47,"value":4268},{"type":41,"tag":81,"props":4627,"children":4628},{"style":242},[4629],{"type":47,"value":1693},{"type":41,"tag":81,"props":4631,"children":4632},{"style":104},[4633],{"type":47,"value":154},{"type":41,"tag":81,"props":4635,"children":4636},{"class":83,"line":422},[4637,4642,4646,4651,4655,4659,4663,4667,4672,4676,4680,4684,4688,4692],{"type":41,"tag":81,"props":4638,"children":4639},{"style":454},[4640],{"type":47,"value":4641},"    expect",{"type":41,"tag":81,"props":4643,"children":4644},{"style":242},[4645],{"type":47,"value":574},{"type":41,"tag":81,"props":4647,"children":4648},{"style":110},[4649],{"type":47,"value":4650},"profile",{"type":41,"tag":81,"props":4652,"children":4653},{"style":104},[4654],{"type":47,"value":555},{"type":41,"tag":81,"props":4656,"children":4657},{"style":110},[4658],{"type":47,"value":824},{"type":41,"tag":81,"props":4660,"children":4661},{"style":242},[4662],{"type":47,"value":508},{"type":41,"tag":81,"props":4664,"children":4665},{"style":104},[4666],{"type":47,"value":555},{"type":41,"tag":81,"props":4668,"children":4669},{"style":454},[4670],{"type":47,"value":4671},"toBe",{"type":41,"tag":81,"props":4673,"children":4674},{"style":242},[4675],{"type":47,"value":574},{"type":41,"tag":81,"props":4677,"children":4678},{"style":104},[4679],{"type":47,"value":149},{"type":41,"tag":81,"props":4681,"children":4682},{"style":141},[4683],{"type":47,"value":4542},{"type":41,"tag":81,"props":4685,"children":4686},{"style":104},[4687],{"type":47,"value":149},{"type":41,"tag":81,"props":4689,"children":4690},{"style":242},[4691],{"type":47,"value":508},{"type":41,"tag":81,"props":4693,"children":4694},{"style":104},[4695],{"type":47,"value":154},{"type":41,"tag":81,"props":4697,"children":4698},{"class":83,"line":430},[4699],{"type":41,"tag":81,"props":4700,"children":4701},{"emptyLinePlaceholder":203},[4702],{"type":47,"value":206},{"type":41,"tag":81,"props":4704,"children":4705},{"class":83,"line":486},[4706,4710,4714,4719,4723],{"type":41,"tag":81,"props":4707,"children":4708},{"style":110},[4709],{"type":47,"value":4465},{"type":41,"tag":81,"props":4711,"children":4712},{"style":104},[4713],{"type":47,"value":555},{"type":41,"tag":81,"props":4715,"children":4716},{"style":454},[4717],{"type":47,"value":4718},"mockRestore",{"type":41,"tag":81,"props":4720,"children":4721},{"style":242},[4722],{"type":47,"value":1693},{"type":41,"tag":81,"props":4724,"children":4725},{"style":104},[4726],{"type":47,"value":154},{"type":41,"tag":81,"props":4728,"children":4729},{"class":83,"line":520},[4730,4734,4738],{"type":41,"tag":81,"props":4731,"children":4732},{"style":104},[4733],{"type":47,"value":3084},{"type":41,"tag":81,"props":4735,"children":4736},{"style":242},[4737],{"type":47,"value":508},{"type":41,"tag":81,"props":4739,"children":4740},{"style":104},[4741],{"type":47,"value":154},{"type":41,"tag":81,"props":4743,"children":4744},{"class":83,"line":529},[4745,4749,4753],{"type":41,"tag":81,"props":4746,"children":4747},{"style":104},[4748],{"type":47,"value":974},{"type":41,"tag":81,"props":4750,"children":4751},{"style":110},[4752],{"type":47,"value":508},{"type":41,"tag":81,"props":4754,"children":4755},{"style":104},[4756],{"type":47,"value":154},{"type":41,"tag":50,"props":4758,"children":4760},{"id":4759},"guidelines",[4761],{"type":47,"value":4762},"Guidelines",{"type":41,"tag":4764,"props":4765,"children":4766},"ul",{},[4767,4773,4793,4811,4816,4828],{"type":41,"tag":4768,"props":4769,"children":4770},"li",{},[4771],{"type":47,"value":4772},"Auth handlers must be registered with a Gateway",{"type":41,"tag":4768,"props":4774,"children":4775},{},[4776,4778,4784,4786,4791],{"type":47,"value":4777},"Use ",{"type":41,"tag":77,"props":4779,"children":4781},{"className":4780},[],[4782],{"type":47,"value":4783},"getAuthData()",{"type":47,"value":4785}," from ",{"type":41,"tag":77,"props":4787,"children":4789},{"className":4788},[],[4790],{"type":47,"value":1505},{"type":47,"value":4792}," to access auth data",{"type":41,"tag":4768,"props":4794,"children":4795},{},[4796,4801,4803,4809],{"type":41,"tag":77,"props":4797,"children":4799},{"className":4798},[],[4800],{"type":47,"value":4783},{"type":47,"value":4802}," returns ",{"type":41,"tag":77,"props":4804,"children":4806},{"className":4805},[],[4807],{"type":47,"value":4808},"null",{"type":47,"value":4810}," in unauthenticated requests",{"type":41,"tag":4768,"props":4812,"children":4813},{},[4814],{"type":47,"value":4815},"Auth data propagates automatically in service-to-service calls",{"type":41,"tag":4768,"props":4817,"children":4818},{},[4819,4821,4826],{"type":47,"value":4820},"Throw ",{"type":41,"tag":77,"props":4822,"children":4824},{"className":4823},[],[4825],{"type":47,"value":1910},{"type":47,"value":4827}," for invalid credentials",{"type":41,"tag":4768,"props":4829,"children":4830},{},[4831],{"type":47,"value":4832},"Keep auth handlers fast - they run on every authenticated request",{"type":41,"tag":4834,"props":4835,"children":4836},"style",{},[4837],{"type":47,"value":4838},"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);}",{"items":4840,"total":770},[4841,4853,4859,4877,4893,4905,4921],{"slug":4842,"name":4842,"fn":4843,"description":4844,"org":4845,"tags":4846,"stars":21,"repoUrl":22,"updatedAt":4852},"encore-api","build type-safe APIs with Encore","Define typed API endpoints in Encore.ts using `api(...)` from `encore.dev\u002Fapi`. Covers typed request\u002Fresponse interfaces, path\u002Fquery\u002Fheader\u002Fcookie params, request validation, and `APIError`. For raw endpoints (`api.raw()`) and inbound webhooks, use `encore-webhook` instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4847,4850,4851],{"name":4848,"slug":4849,"type":16},"API Development","api-development",{"name":9,"slug":8,"type":16},{"name":18,"slug":19,"type":16},"2026-04-06T18:09:46.044101",{"slug":4,"name":4,"fn":5,"description":6,"org":4854,"tags":4855,"stars":21,"repoUrl":22,"updatedAt":23},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4856,4857,4858],{"name":14,"slug":15,"type":16},{"name":9,"slug":8,"type":16},{"name":18,"slug":19,"type":16},{"slug":4860,"name":4860,"fn":4861,"description":4862,"org":4863,"tags":4864,"stars":21,"repoUrl":22,"updatedAt":4876},"encore-bucket","store files in Encore.ts buckets","Store unstructured files in Encore.ts using `Bucket` from `encore.dev\u002Fstorage\u002Fobjects` — uploads, images, documents, blobs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4865,4868,4869,4872,4875],{"name":4866,"slug":4867,"type":16},"Backend","backend",{"name":9,"slug":8,"type":16},{"name":4870,"slug":4871,"type":16},"File Storage","file-storage",{"name":4873,"slug":4874,"type":16},"File Uploads","file-uploads",{"name":18,"slug":19,"type":16},"2026-05-16T05:59:52.813772",{"slug":4878,"name":4878,"fn":4879,"description":4880,"org":4881,"tags":4882,"stars":21,"repoUrl":22,"updatedAt":4892},"encore-cache","cache data in Redis with Encore.ts","Cache data in Redis from Encore.ts using `CacheCluster` and typed keyspaces from `encore.dev\u002Fstorage\u002Fcache`. Type-safe key\u002Fvalue access with TTLs, atomic increments, and per-keyspace data shapes.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4883,4884,4887,4888,4891],{"name":4866,"slug":4867,"type":16},{"name":4885,"slug":4886,"type":16},"Caching","caching",{"name":9,"slug":8,"type":16},{"name":4889,"slug":4890,"type":16},"Redis","redis",{"name":18,"slug":19,"type":16},"2026-05-16T05:59:56.808328",{"slug":4894,"name":4894,"fn":4895,"description":4896,"org":4897,"tags":4898,"stars":21,"repoUrl":22,"updatedAt":4904},"encore-code-review","review Encore.ts code","Review existing Encore.ts code for best practices and common anti-patterns.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4899,4902,4903],{"name":4900,"slug":4901,"type":16},"Code Review","code-review",{"name":9,"slug":8,"type":16},{"name":18,"slug":19,"type":16},"2026-04-06T18:10:01.123999",{"slug":4906,"name":4906,"fn":4907,"description":4908,"org":4909,"tags":4910,"stars":21,"repoUrl":22,"updatedAt":4920},"encore-cron","schedule recurring jobs in Encore.ts","Schedule periodic \u002F recurring work in Encore.ts using `CronJob` from `encore.dev\u002Fcron`. Covers `every: \"1h\"` interval syntax and `schedule: \"0 9 * * 1\"` cron expressions.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4911,4914,4915,4916,4919],{"name":4912,"slug":4913,"type":16},"Automation","automation",{"name":4866,"slug":4867,"type":16},{"name":9,"slug":8,"type":16},{"name":4917,"slug":4918,"type":16},"Scheduling","scheduling",{"name":18,"slug":19,"type":16},"2026-05-16T05:59:54.146651",{"slug":4922,"name":4922,"fn":4923,"description":4924,"org":4925,"tags":4926,"stars":21,"repoUrl":22,"updatedAt":4935},"encore-database","build Encore databases","Work with PostgreSQL in Encore.ts using `SQLDatabase` from `encore.dev\u002Fstorage\u002Fsqldb` — schema migrations and SQL queries.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4927,4930,4931,4934],{"name":4928,"slug":4929,"type":16},"Database","database",{"name":9,"slug":8,"type":16},{"name":4932,"slug":4933,"type":16},"ORM","orm",{"name":18,"slug":19,"type":16},"2026-04-06T18:09:54.823017",{"items":4937,"total":770},[4938,4944,4950,4958,4966,4972,4980,4987,5004,5021,5033,5044],{"slug":4842,"name":4842,"fn":4843,"description":4844,"org":4939,"tags":4940,"stars":21,"repoUrl":22,"updatedAt":4852},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4941,4942,4943],{"name":4848,"slug":4849,"type":16},{"name":9,"slug":8,"type":16},{"name":18,"slug":19,"type":16},{"slug":4,"name":4,"fn":5,"description":6,"org":4945,"tags":4946,"stars":21,"repoUrl":22,"updatedAt":23},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4947,4948,4949],{"name":14,"slug":15,"type":16},{"name":9,"slug":8,"type":16},{"name":18,"slug":19,"type":16},{"slug":4860,"name":4860,"fn":4861,"description":4862,"org":4951,"tags":4952,"stars":21,"repoUrl":22,"updatedAt":4876},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4953,4954,4955,4956,4957],{"name":4866,"slug":4867,"type":16},{"name":9,"slug":8,"type":16},{"name":4870,"slug":4871,"type":16},{"name":4873,"slug":4874,"type":16},{"name":18,"slug":19,"type":16},{"slug":4878,"name":4878,"fn":4879,"description":4880,"org":4959,"tags":4960,"stars":21,"repoUrl":22,"updatedAt":4892},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4961,4962,4963,4964,4965],{"name":4866,"slug":4867,"type":16},{"name":4885,"slug":4886,"type":16},{"name":9,"slug":8,"type":16},{"name":4889,"slug":4890,"type":16},{"name":18,"slug":19,"type":16},{"slug":4894,"name":4894,"fn":4895,"description":4896,"org":4967,"tags":4968,"stars":21,"repoUrl":22,"updatedAt":4904},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4969,4970,4971],{"name":4900,"slug":4901,"type":16},{"name":9,"slug":8,"type":16},{"name":18,"slug":19,"type":16},{"slug":4906,"name":4906,"fn":4907,"description":4908,"org":4973,"tags":4974,"stars":21,"repoUrl":22,"updatedAt":4920},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4975,4976,4977,4978,4979],{"name":4912,"slug":4913,"type":16},{"name":4866,"slug":4867,"type":16},{"name":9,"slug":8,"type":16},{"name":4917,"slug":4918,"type":16},{"name":18,"slug":19,"type":16},{"slug":4922,"name":4922,"fn":4923,"description":4924,"org":4981,"tags":4982,"stars":21,"repoUrl":22,"updatedAt":4935},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4983,4984,4985,4986],{"name":4928,"slug":4929,"type":16},{"name":9,"slug":8,"type":16},{"name":4932,"slug":4933,"type":16},{"name":18,"slug":19,"type":16},{"slug":4988,"name":4988,"fn":4989,"description":4990,"org":4991,"tags":4992,"stars":21,"repoUrl":22,"updatedAt":5003},"encore-frontend","connect frontend to Encore backend","Connect a frontend application (React, Next.js, Vue, Svelte, etc.) to an Encore.ts backend.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4993,4994,4997,5000],{"name":9,"slug":8,"type":16},{"name":4995,"slug":4996,"type":16},"Frontend","frontend",{"name":4998,"slug":4999,"type":16},"Next.js","next-js",{"name":5001,"slug":5002,"type":16},"React","react","2026-04-06T18:09:56.091006",{"slug":5005,"name":5005,"fn":5006,"description":5007,"org":5008,"tags":5009,"stars":21,"repoUrl":22,"updatedAt":5020},"encore-getting-started","build and run applications with Encore.ts","Bootstrap a brand-new Encore.ts project from zero. Only for first-time CLI install and `encore app create` — not for architecture or feature questions.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5010,5011,5012,5013,5016,5017],{"name":4848,"slug":4849,"type":16},{"name":4866,"slug":4867,"type":16},{"name":9,"slug":8,"type":16},{"name":5014,"slug":5015,"type":16},"Local Development","local-development",{"name":18,"slug":19,"type":16},{"name":5018,"slug":5019,"type":16},"Web Development","web-development","2026-04-06T18:10:04.885446",{"slug":5022,"name":5022,"fn":5023,"description":5024,"org":5025,"tags":5026,"stars":21,"repoUrl":22,"updatedAt":5032},"encore-go-api","build APIs with Encore Go","Define typed API endpoints in Encore Go using `\u002F\u002Fencore:api` annotations. Covers typed request\u002Fresponse structs, path\u002Fquery\u002Fheader\u002Fcookie params, and error returns. For raw endpoints (`\u002F\u002Fencore:api raw`) and inbound webhooks, use `encore-go-webhook` instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5027,5028,5029],{"name":4848,"slug":4849,"type":16},{"name":9,"slug":8,"type":16},{"name":5030,"slug":5031,"type":16},"Go","go","2026-04-06T18:09:48.578781",{"slug":5034,"name":5034,"fn":5035,"description":5036,"org":5037,"tags":5038,"stars":21,"repoUrl":22,"updatedAt":5043},"encore-go-auth","implement authentication with Encore Go","Protect Encore Go endpoints with authentication and authorize callers. Covers `auth.AuthHandler`, `auth.UserID`, the `Authorization` header, and `\u002F\u002Fencore:api auth`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5039,5040,5041,5042],{"name":14,"slug":15,"type":16},{"name":4866,"slug":4867,"type":16},{"name":9,"slug":8,"type":16},{"name":5030,"slug":5031,"type":16},"2026-04-06T18:09:51.065102",{"slug":5045,"name":5045,"fn":5046,"description":5047,"org":5048,"tags":5049,"stars":21,"repoUrl":22,"updatedAt":5057},"encore-go-bucket","store files in Encore Go buckets","Store unstructured files in Encore Go using `objects.NewBucket` from `encore.dev\u002Fstorage\u002Fobjects` — uploads, images, documents, blobs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5050,5051,5052,5053,5054],{"name":4866,"slug":4867,"type":16},{"name":9,"slug":8,"type":16},{"name":4870,"slug":4871,"type":16},{"name":5030,"slug":5031,"type":16},{"name":5055,"slug":5056,"type":16},"Storage","storage","2026-05-16T06:00:03.633918"]