Btoa method is not defined

Hello community.

I am trying to encode the API Key in B64 to been able to have a secured communication. Baed on what I have read at different forums, including : How do you encode api key to base64 for freshdesk?
It suggests to use the method: btoa, but it always sayis that that bethod is not defined:

I have a serverless app, so I retrieve the iparams:

    //console.log(args);
    var subdomain = args['iparams']['fd_domain'];
    var subdomain = args['iparams']['api_key'];
    var EncodedAuthentication = btoa(apiKey.value);
    console.log(EncodedAuthentication); 

And that is the ouput:

Can somebody assists me?

Regards

1 Like