Interview practice question
Where to store tokens in a web app
Backend Engineering · Auth and Security · Beginner
Your single-page web app receives a JWT after login. Where should it store the token?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- localStorage readable by XSS.
- HttpOnly Secure cookie safer from XSS.
- Then need CSRF protection (SameSite).
- Short-lived access tokens.
- BFF pattern keeps tokens server-side.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.