🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Authentication, Sessions and JWT: all 10 questions

Quiz: Authentication, Sessions and JWT · Question 8 of 10

Where is it risky to keep a login token in the browser?

Where is it risky to keep a login token in the browser?

  1. A.localStorage, because any injected script can read it
  2. B.An HttpOnly cookie
  3. C.Only in memory
  4. D.Nowhere; all places are equally safe
Answer & explanation

Correct answer: localStorage, because any injected script can read it

JavaScript-readable storage is exposed if the site ever has an XSS bug.

Can you get the rest right without peeking?

Take the timed Quiz: Authentication, Sessions and JWT quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →