You can find a Base64 encode/decode method here.
[Link: scotch.io]Look at the 2nd section for browsers that don't support the encoding natively. There is a single-line object defined that you can use in Pronto to encode the HTTP Request Header if you want to build your own http client as I did in the first example.
Authentication: Basic [base64 encoded username:password string]
Add the HTTP Request header with this...
socket.write("Authentication: Basic base64string\r\n");