You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! Thanks for making this api. I had given up last year after having been unable to find anything useable in my React application. I have kind of a weird issue, I installed the api and used it once with success. I was able to add my email to my group and verified it inside my MailerLite account. When I went to make a component that did that (it was originally just raw html inside another component), I got an error code saying access was denied. Specifically, it says:
Here is my MailerLite.js file:
const MailerLite = require('mailerlite-api-v2-node').default;
var apikey = example_api_key;
const mailerlite = MailerLite(apikey);
export default mailerlite;
Here is the function I am using to post my new subscriber:
addEmailSub = () => {
var email = document.getElementById("email").value;
mailerlite.addSubscriberToGroup(104625980, email);
}
Any input would be appreciated!
The text was updated successfully, but these errors were encountered:
API key is designed for server-side usage and it cannot be used directly on the client side making AJAX calls because it will be exposed publicly. So it is forbidden due to security concerns.
Hey! Thanks for making this api. I had given up last year after having been unable to find anything useable in my React application. I have kind of a weird issue, I installed the api and used it once with success. I was able to add my email to my group and verified it inside my MailerLite account. When I went to make a component that did that (it was originally just raw html inside another component), I got an error code saying access was denied. Specifically, it says:
"Access to XMLHttpRequest at 'https://api.mailerlite.com/api/v2/groups/104625980/subscribers' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field x-mailerlite-apikey is not allowed by Access-Control-Allow-Headers in preflight response."
Here is my MailerLite.js file:
const MailerLite = require('mailerlite-api-v2-node').default;
var apikey = example_api_key;
const mailerlite = MailerLite(apikey);
export default mailerlite;
Here is the function I am using to post my new subscriber:
addEmailSub = () => {
var email = document.getElementById("email").value;
mailerlite.addSubscriberToGroup(104625980, email);
}
Any input would be appreciated!
The text was updated successfully, but these errors were encountered: