EncodeBase64 and DecodeBase64 Server Code System Libraries
Introduction
Encoding to base64 is widely used for Basic authentication and it is now added to the Appery.io system libraries.
And so is decoding just in case :)
In this document, we will show how you can use these system libraries in the script.
Note
You can find more examples in the MailgunEmail Server Code plugin.
- Create a new Server Code script:
- Name the script to TestEncodeDecodeLibs and replace the default script with the below sample code and save:
const user = "test";
const pass = "123";
const encoded = encodeBase64(user + ":" + pass);
console.log("encoded: " + encoded);
const decoded = decodeBase64(encoded);
console.log("decoded: " + decoded);
Here is how the new script should look like:
- Go to the script Dependencies tab and select the libraries:
- EncodeBase64
- DecodeBase64:
- Then go back to the script Run tab and test your script:
Updated almost 3 years ago