let's assume that there is a service out there as following;
http://exmaple.com/service1/GetSomething?apikey={api-key-goes-here}
an my api key is : 96a143c8-2f62-470c-b81f-dec5fc271873
so we will be making calls to > http://exmaple.com/service1/GetSomething?apikey=96a143c8-2f62-470c-b81f-dec5fc271873 link and it gives back the response as JSON.
when I consume that with JQuery (or any other client side JavaScript library), how will that key will be secure? I am thinking that and I figured there is no way. If I am going to make a call to that service with client side call, it will be our in the open.
any idea on this?
thanks.
Make a proxy.
Post the values to one of your pages and from this page make the real request on the server-side, then return the value you get.
Of note: You cannot make a cross-domain request with javascript, mainly browsers don't allow this for security reasons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With