Hello,
I am trying to integrate ActiveCampaign API but encounter problem related to CORS.
I am using javascript fetch api for Retrieve a user by email endpoints.
Here is my code
Hi! Yes, you are going to run into CORS issues if you try to use the API from frontend JavaScript. This is by design. I cannot emphasize enough, embedding your API token in frontend JavaScript is a big security issue. Putting the API token in your JavaScript would be the same as giving away your username and password. Anyone could take the token and use it to retrieve all of your contacts or worse.
I suggest you create a secure backend service or use secured serverless functions (e.g. AWS Lambdas, Azure Functions, or Netlify Functions) that you call from your frontend. That backend service or serverless function would then do the work of calling the ActiveCampaign API and return the appropriate response.