I have a web application that pulls data from my newly created JSON api.
My static HTML pages dynamically calls the JSON api via JavaScript from the static HTML page.
How do I restrict access to my JSON api so that only I (my website) can call from it?
In case it helps, my api is something like: http://example.com/json/?var1=x&var2=y&var3=z... which generates the appropriate JSON based on the query.
I'm using PHP to generate my JSON results ... can restricting access to the JSON api be as simply as checking the $_SERVER['HTTP_REFERER']
to ensure that the api is only being called from my domain and not a remote user?