Im trying call one endpoint from marketing cloud rest api with AJAX, but im having problems with CORS.
This is the error: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You should never invoke this or any similar API from the frontend / client side. If you do so your credentials (client id and secret) are exposed to everyone. A user can therefore attack (depending on the scope of your installed package) your marketing cloud instance massively!
If there is just an isolated function you need to perform in your instance, you could do this directly from a processing page you create using CloudPages and access the functionality via SSJS or AMPscript (even using native functions or the API).
However, also for this approach you should verify the input payload and only perform the action if it is/seems legitimate.
If you need more information or have questions regarding information security I suggest checking the Open Web Application Security Project's guidelines, as well as checking out Information Security Stack Exchange: