3rd Party Service Log In

I’m trying to log in to a 3rd party service and am getting an error that says, “Cannot find base64.” Is there an alternative to installing the crypto-js library?

import {fetch} from ‘wix-fetch’;

let url = ‘https://services.onetcenter.org/ws/’;
let username = ‘user’;
let password = ‘passwd’;
let headers = {
‘Authorization’: 'Basic ’ + base64.encode(username + “:” + password)
};
let options = {
method:‘POST’,
headers: headers
}
fetch(url, options)
.then((httpResponse) => {
// Add code to check the response
})

I had more luck with this:

import { base64encode } from 'nodejs-base64';

And you will have to install the NPM.

Thank you, Giri! I’ll give it a try.