Btoa method is not defined

Hi thanks all.
Finally I have solved it.

Step 1. (Only if required)
If you do not have the btoa on your local machine, download it. To do so, you simply need to open your console and set the next command:

npm install btoa

Step 2.
At the manifest, include the dependecy of the btoa:

{
  "platform-version": "2.0",
  "product": {
    "freshdesk": {}
  },
  "whitelisted-domains": [
    "https://DOMAIN.freshdesk.com"
],
  "dependencies": {
    "btoa" : "1.2.1"
  } 
}

*It might be needed another version. Check the version that you are using from Step 1

Step 3.
At the beginig of your server.js you include:

var btoa = require('btoa');

That has made that the line:

var EncodedAuthentication = btoa(apiKey+":X");

Works without any problem.

Hope it helps.

Regards

2 Likes