Skip to content
Sign upLog in
← Back to Community

Clash Royale API with Axios

Profile icon
SamKunefeh

Hello everyone, I tried using the ClashRoyaleAPI with node.js but it doesn’t work cause there’s and error 403 forbidden. I know that it means that I don’t have permission to access the data, but it should be because my token is correct. So am I missing something in my code?

Answered by RemoryX [earned 5 cycles]
View Answer
Voters
Profile icon
EverestChang
Profile icon
RemoryX
Profile icon
SamKunefeh
Comments
hotnewtop
Profile icon
RemoryX

Hey! So I was a bit confused as to why this wasn't working when I saw it. I checked the Clash Royale API and got a key, and I believe the issue is that it requires you to register a static IP address for the key. I did some searching and found there is a 3rd party service that can and will serve as a proxy for your requests.

The proxy URL is proxy.royaleapi.dev - and the static IP you should use when you get a key is 128.128.128.128

Should work on Replit if you use this method!

brave_8r44SJ1699

Edit for clarification: Your code is correct, as it is making the request- the reason you need to use the proxy url is because Repls will occasionally shift between machines, meaning the whole static IP requirement becomes an issue. I tested this method before posting this, and it worked perfectly :)

Profile icon
SamKunefeh

@RemoryX
Oh my god thank you so much! I was so frustrated over this problem for like a week straight. If there was an option for rewarding 50 cycles, I would honestly give you that! :)

Profile icon
SamKunefeh

@RemoryX
but just curious, why does only the ip “ 128.128.128.128” work with the proxy?

Profile icon
RemoryX

@Jackbaklava
It is possible I may be incorrect, but from what I could tell, that is the IP of the machine the proxy server runs on

Profile icon
SamKunefeh

@RemoryX
Thanks alot! Btw you play clash royale?

Profile icon
RemoryX

@Jackbaklava
I do not actually, I just saw this question and was puzzled, and decided to solve said puzzle ;)

Profile icon
SamKunefeh

@RemoryX
lol, my bad!

Profile icon
SamKunefeh

Sorry for the mistake but I didn’t use axios