I am creating a JavaScript SDK for our API. The API currently requires (2-legged) OAuth authentication. Obviously, this is not suitable for the JS SDK, since the key and secret are on a simple site (in the JS code).
Facebook only requires your application ID when you start your JS SDK, so I would like to implement something similar (or with the same simplicity). When a developer requests a key, we need an application domain. I was thinking about finding the IP address of the submitted domain (for example, myclientapp.com has 192.168.0.0 IP). And then authentication of the JavaScript requests by verifying the IP address of the remote hosts.
Is this the best / easiest way to do this?
UPDATE: because Rup indicated that the remote IP address will be the client and therefore will not match the IP address of the applications. So that. Therefore, to repeat, I'm looking for a solution that will allow me to apply some form of authentication in my JavaScript-sdk for my API, which cannot be faked by someone else (trying to be someone in an elses application).
Thanks,
Gavin
source share