How to keep API keys secret when using client side Javascript? How to keep API keys secret when using client side Javascript? javascript javascript

How to keep API keys secret when using client side Javascript?


In three words: server-side validation. FB itself will throw an error when you use a key that's incorrect for the given site. The API key is not supposed to be secret (as opposed to the secret key).


I haven't done this myself, but I know that the kind of attack you are worried about is called Cross-site Request Forgery (CSRF). The Wikipedia article on that gives some hints on how to prevent it.