Koa Sessions and Cookies
Question Variations
- "What is `app.keys` used for in Koa?"
- "Why are signed cookies not encrypted cookies?"
- "Why does a local session store fail behind a load balancer?"
Why This Is Asked
Session handling tests browser security knowledge and Koa-specific cookie APIs. Interviewers want to see cookie flags, key rotation, and an understanding of server-side state at scale.
Key Concepts
ctx.cookiesreads and writes cookies; signed cookies require configuredapp.keys.HttpOnly,Secure, andSameSitehave different protections.- Server-side sessions need a shared store in multi-instance deployments.
- Rotate identifiers on authentication and expire sessions deliberately.
Question Variations
- “What is
app.keysused for in Koa?” - “Why are signed cookies not encrypted cookies?”
- “Why does a local session store fail behind a load balancer?”