Skip to content Skip to sidebar Skip to footer

Calling Easypost API From Browser Client Javascript

I am trying to call Easypost APIs from javascript/jquery (yes, I know it is a 'bad' idea because the JS code contains the cleartext account key, but this JS and HTML are in a secur

Solution 1:

That means the easypost API server does not accept CORS request or requests originating from localhost.

Based on their documentation, they only provide server side libraries to interact with their API. My guess is you won't be able to interact directly with it from your web app.

Your best bet is to use a proxy, you can develop one yourself or use something like node-http-proxy to proxy your API calls. (There are php or python equivalents)

The proxy server will be able to issue the requests and will then forward them to your app.

Suggested further reading: type understanding CORS on google and read more about it.


Post a Comment for "Calling Easypost API From Browser Client Javascript"