Node.js · Middle · Question 44 of 75

How do you generate a cryptographically secure random token?

Explanation

Math.random() is predictable and must not be used for tokens, session IDs or password reset links.

Further reading

Problem with a question

Node.js · Middle · question 44

Test yourself

Take the Node.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz