Skip to content

Instantly share code, notes, and snippets.

@ashkanRmk
Created July 16, 2018 06:42
Show Gist options
  • Save ashkanRmk/c67d59fb56355643976d45d497b295a2 to your computer and use it in GitHub Desktop.
Save ashkanRmk/c67d59fb56355643976d45d497b295a2 to your computer and use it in GitHub Desktop.
function base64URLEncode(str) {
return str.toString('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=/g, '');
}
var verifier = base64URLEncode(crypto.randomBytes(32));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment