My problem is, when I fetch on Javascrip with the API, I have a CORS error and I need to allow “Access-Control-Allow-Headers”.
I have searching everywhere but nothing works … I have see maybe any technics but I am a beginner in HTML/CSS/JS and the use PHP or other language.
Do you know if there is a solution for this with JS?
Thank you !
We can’t support you with Supercell API issues. You can try joining our dev server: https://discord.royaleapi.dev — that said, in general you should never fetch from the browser because that exposes your keys on the internet. the workaround is to use a server.
Thank you for your message !
I will try on Discord, thank you ! It’s only for a personal project for training , do you know the reason?
I have already told you the reason — trying to request API directly in the browser will expose your token, which is the worst thing you can do to API security.