//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; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter