How to get around CORS error from third party API
What are CORS error? CORS is an acronym for Cross-origin Resource Sharing, it is an HTTP header that allows a server choose an origin other than its own to have access to its resources. The origin in this case include domain and port. For instance I as the admin of https://xyz.com can determine if I want other domains to access resources on my server. Having gotten a basis of what CORS is, it is worthy of note that for security reasons browsers implement a CORS safety feature by default when a fetch API is being called from script. What happens is that the browser checks the header of the requested resources to see if the header contains the right CORS header. This situation can be easily solved if you have access to the server, as you can easily include the origin on the server page. Most developers get frustrated when they are trying to fetch a third party API using a script and run into CORS error. I had such case with justsms.com.ng, their API can only be called from a script ...