There is an integration with an API for conducting live online classes. The API wanted us to post a form to their site along with a parameter called customer_token as an input field. It is used for authentication by the API and every customer site is assigned one token. The customer token is actually some hashed value of the domain name or IP or something.
Now, after the integration, they want me to hide the customer_token input field somehow from being accessible through mozilla’s firebug and similar tools, because anybody can see the token and send a similar form to the API and access the API’s service. Needless to say, the API is not developed by some experts. They did not realize the issue before and it is not a widely used API.
I asked a question previously on Best way to hide a form input field from being accessed using firebug? and realised that it is not possible to hide any information through a get/post method. Someone asked me about whether the request is directly being sent to the api, or first to my server or something?
Please explain how does it fix the security issue and how do I implement it?
Thanks,
Sandeepan
You could POST to your server, which in a script, POSTs all the parameters to the API form action, but with the
customer_tokenadded in your script, server-side, which clients can’t see.So, you have your original form:
And instead use:
Note that there’s no
customer_tokenin the second example. Then, inmyapiblah.php– change the name obviously, especially depending on the server-side language you’re using. I might be able to provide more specific examples if you tell me what you use – use something like this psuedo-code:You’ll need to look up the details of what to use for
send_http_request.In PHP, you’d do something like this, if you can use the
pecl_httpstuff in PECL: