Base64 URL-encoded SHA-256 hash of the code verifier

Someone have an example of how to do this in Javascript?

The examples in the developer docs show

code_verifier
M25iVXpKU3puUjFaYWg3T1NDTDQtcW1ROUY5YXlwalNoc0hhakxifmZHag

code_challenge
qjrzSW9gMiUgpUvqgEPE4_-8swvyCtfOVvg55o5S_es

But when I run the code verifier through nearly every online SHA 256 Hash generator I get
aa3af3496f60322520a54bea8043c4e3ffbcb30bf20ad7ce56f839e68e52fdeb

Taken from here - https://tonyxu-io.github.io/pkce-generator/

    function generateCodeChallenge(code_verifier) {
      return code_challenge = base64URL(CryptoJS.SHA256(code_verifier))
    }
    function base64URL(string) {
      return string.toString(CryptoJS.enc.Base64).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_')
    }

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.