← Quiz: Authentication, Sessions and JWT: all 10 questions
Quiz: Authentication, Sessions and JWT · Question 4 of 10
What does this print? (code)
What does this print?
const payload = Buffer.from(JSON.stringify({ sub: 42, role: "student" })).toString("base64url");
console.log(JSON.parse(Buffer.from(payload, "base64url").toString()).role);
- A.An error, because the payload is encrypted
- B.student
- C.42
- D.undefined
Answer & explanation
Correct answer: student
Base64URL is only an encoding, so anyone can decode a JWT payload and read it.
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 →