title: generate password reset token in node.js
body: <p>How do I generate a password reset token in node.js that can be used in a url?</p>
  
  <p>I just need the method for generating the token:</p>
  
  <pre><code>user.reset_password_token = ???;
  user.reset_password_expire = expire_date;
  </code></pre>
  
  <p>Edit -- here's the solution:</p>
  
  <pre><code>user.reset_password_token = require('crypto').randomBytes(32).toString('hex');
  </code></pre>