Node.js Code Completion Medium +20 XP
JWT Sign
Complete to sign a JSON Web Token.
Node.jsFill in the blank
const token = jwt.___(payload, SECRET, { expiresIn: '1h' });Type the missing code
Show answer and explanation
Answer: sign
jwt.sign() creates a signed JWT token. The secret key signs it so it can be verified later. expiresIn sets the TTL.
Hint: Which jwt method creates a new token?
What this challenge tests
Code Completion in Node.js: jwt, auth.