API fetching problem
I want to fetch an API (i dont own this) and when i fetch it with my browser, postman, CURL, some VSCode extensions for fetching API,... it works fine, perfectly.
But when i use fetch() in my node project, i cant fetch the API, the API seems blocked me (it return Blocked by <the website> )
any idea ? please help ❤️
16 Replies
Probably CORS
Web Dev Simplified
YouTube
Learn CORS In 6 Minutes
CORS, also known as Cross-Origin Resource Sharing, is something every web developer has to deal with at some point. Chances are if you are watching this video then you are probably dealing with a CORS error right now. In this video I will tell you what CORS is and how you can fix CORS errors.
📚 Materials/References:
CORS Blog Article: https:/...
MDN Web Docs
Cross-Origin Resource Sharing (CORS) - HTTP | MDN
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by which browsers make a "preflight" request to the server hosting the cross-origin resource, in ord...
then it must say blocked by CORS?
instead it just say
Blocked...
(Browser)
idk what is (Browser) mean
it'll be so much easier for people to help if you share your code (in a code block, not as a screenshot) and text / screenshots of the error
its just a simple fetch
i tried edge, opera for the header
still same error
not really error, the site return this
that really looks like you're trying to circumvent a restriction on the API
you're adding a ton of headers that you probably pulled from the network tab?
its the same without those header
right
discussing ways of breaking the TOS for other sites is against Discord TOS
not breaking tbh
their site still working for me
their site is making legitimate use of their API, and from what I see, you're trying to use their API for your own site
hm that sound right
that's usually not allowed. They are clearly trying to restrict you from doing exactly what you're trying to do
but why in the network tab i dont really see any checking to block that
that's irrelevant
I'm locking this topic, helping you break this other site's TOS can get this server in trouble, so discussion of this topic is simply not allowed in this context
k