🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.localStorage
  2. B.An HttpOnly, Secure cookie
  3. C.A URL query parameter
  4. 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 →