I'm tryng to authenticate with mailchimp api in order to perform some api calls. I'm using Axios and I try some different codes but i'm still having the same error on authentication (i intercept the catch but i not receive a real error code)
I'm using axios with standard get notation. i tried also to add header autentication or to add explicit base64 encoded usr:passwd You can see at: https://codesandbox.io/embed/mailchimp-v3-test-zyfm8
try {
const response = await axios.get(url, {
auth: { username: usr, password: apikey }
});
if (response) {
console.log(response);
}
} catch (e) {
console.log(e);
}
Test with base64
const credentials = btoa(username + ':' + password);
const basicAuth = 'Basic ' + credentials;
axios.post(session_url, {
headers: { 'Authorization': + basicAuth }
}).then(function(response) {
console.log('Authenticated');
}).catch(function(error) {
console.log('Error on Authentication');
});
i receive a "error {}" console log, not the success response i expect
the following comment i received i think solve: "Because of the potential security risks associated with exposing account API key, Mailchimp does not support client-side implementation of our API using CORS requests”