consent/self-service-portal/web/app/src/components/pkce.utils.js
// Base64-urlencodes the input string
Base64-urlencodes the input string
Base64 - urlencodes the input string
function base64urlencode (str) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(str)))
    .replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
function base64urlencode ( str ) { return btoa ( String . fromCharCode . apply ( null , new Uint8Array ( str ) ) ) . replace ( / \+ / g , '-' ) . replace ( / \/ / g , '_' ) . replace ( / =+$ / , '' ) ; }
Base64-urlencodes the input string
Base64 - urlencodes the input string
// Convert the ArrayBuffer to string using Uint8 array to conver to what btoa accepts. // btoa accepts chars only within ascii 0-255 and base64 encodes them. // Then convert the base64 encoded to base64url encoded //   (replace + with -, replace / with _, trim trailing =)