Consegui fazer
//TESTE4
const uuidv4 = require('uuid/v4');
let code = uuidv4()
console.log("Code: " + code);
let hexadecimal = CryptoJS.enc.Hex.parse(code)
console.log("Hexadecimal: " + hexadecimal);
let base64 = CryptoJS.enc.Base64.stringify(hexadecimal).replace(///g, '_').replace(/+/g, '-').replace(/=/g, '')
console.log("HexToBase64: " + base64);
let sha256 = CryptoJS.SHA256(base64)
console.log("Base64ToSHA256: " + sha256);
let sha256_base64 = CryptoJS.enc.Base64.stringify(sha256).replace(///g, '_').replace(/+/g, '-').replace(/=/gConsegui fazer, '')
console.log("Sha256toBase64: " + sha256_base64);
console.log('==========================================================');
// TESTE5
const randomize = require('randomatic');
let code1 = randomize(32)
console.log('Code: ' + code1);
let hexadecimal1 = CryptoJS.enc.Hex.parse(code1)
console.log('CodeToHex: ' + hexadecimal1);esses dois códigos deram certo para mim
let base641 = CryptoJS.enc.Base64.stringify(hexadecimal1).replace(///g, '_').replace(/+/g, '-').replace(/=/g, '')
console.log('HexToBase64: ' + base641);TESTE4
let sha2561 = CryptoJS.SHA256(base641)
console.log('Base64ToSHA256: ' + sha2561);
const uuidv4 = require('uuid/v4');
let code = uuidv4()
console.log("Code: " + code);
let hexadecimal = CryptoJS.enc.Hex.parse(code)
console.log("Hexadecimal: " + hexadecimal);
let base64 = CryptoJS.enc.Base64.stringify(hexadecimal).replace(/\//g, '_').replace(/\+/g, '-').replace(/\=/g, '')
console.log("HexToBase64: " + base64);
let sha256 = CryptoJS.SHA256(base64)
console.log("Base64ToSHA256: " + sha256);
let sha256_base64 = CryptoJS.enc.Base64.stringify(sha256).replace(/\//g, '_').replace(/\+/g, '-').replace(/\=/g, '')
console.log("Sha256toBase64: " + sha256_base64);
console.log('==========================================================');
let sha256_base641 = CryptoJS.enc.Base64.stringify(sha2561).replace(///g, '_').replace(/+/g, '-').replace(/=/g, '')
console.log('Sha256ToBase64: ' + sha256_base641);TESTE5
Esses dois códigos deram certo para mim
const randomize = require('randomatic');
let code1 = randomize(32)
console.log('Code: ' + code1);
let hexadecimal1 = CryptoJS.enc.Hex.parse(code1)
console.log('CodeToHex: ' + hexadecimal1);
let base641 = CryptoJS.enc.Base64.stringify(hexadecimal1).replace(/\//g, '_').replace(/\+/g, '-').replace(/\=/g, '')
console.log('HexToBase64: ' + base641);
let sha2561 = CryptoJS.SHA256(base641)
console.log('Base64ToSHA256: ' + sha2561);
let sha256_base641 = CryptoJS.enc.Base64.stringify(sha2561).replace(/\//g, '_').replace(/\+/g, '-').replace(/\=/g, '')
console.log('Sha256ToBase64: ' + sha256_base641);