← Quiz: JWT and API Security: all 10 questions
Quiz: JWT and API Security · Question 4 of 10
Which is a good place to store a session token in a browser app to limit XSS theft?
Which is a good place to store a session token in a browser app to limit XSS theft?
- A.localStorage
- B.An HttpOnly, Secure cookie
- C.A URL query parameter
- D.A global JavaScript variable
Answer & explanation
Correct answer: An HttpOnly, Secure cookie
HttpOnly cookies can't be read by JavaScript, so XSS can't simply copy them.
Can you get the rest right without peeking?
Take the timed Quiz: JWT and API Security quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →