//This function allows you to set the token length and allowed characters. //tokenLength = 64 function generateToken(64) { var generatedToken = ''; var allowedCharacters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for(var i = 0; i < n; i++) { generatedToken += allowedCharacters[Math.floor(Math.random() * allowedCharacters.length)]; } console.log(generatedToken); return generatedToken; }