← 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?
- A.localStorage, because any injected script can read it
- B.An HttpOnly cookie
- C.Only in memory
- 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 →