🎙 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 5 of 10

An attacker changes the role inside a JWT payload from "student" to "admin". What stops this from working?

An attacker changes the role inside a JWT payload from "student" to "admin". What stops this from working?

  1. A.The payload is encrypted
  2. B.The signature no longer matches, and the attacker cannot make a new one without the server's secret
  3. C.Browsers block edited tokens
  4. D.JWTs cannot contain roles
Answer & explanation

Correct answer: The signature no longer matches, and the attacker cannot make a new one without the server's secret

The signature covers header and payload, so any change is detected on verification.

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 →