Function - how to do btoa javascript function


for an HTTP request, I need to use btoa to base64 encode the token.
As btoa is part of the window class which does not seem to be available - how can I do this instead?

Btw, a little “bug” here: If I create an expression for a HTTP Request variable, btoa works in the preview (I guess because I am in the browser?) but not when its executed on the server. This is a bit tricky for finding out why things work or not…


Hey @JoEDU!

Maybe you can use the Crypto node to encode the string to base64.

Let me know if you can’t use the node in your use-case.

Thanks. How can I just base64 encode a string with Crypto without doing any other fancy stuff like hashing?

I now found the solution myself, in Node.js the code needs to be:

1 Like

I am glad you found a solution!

Have fun :slightly_smiling_face: