I want to make Phonegap application, in which I will use PHP API and AJAX calls to it for communication.
The problem is security - when I make AJAX calls to my PHP API - the address is visible for anyone who can read js files and they can easily manipulate the data. I am thinking of two things that can be useful, but still not what I am looking for.
- CSRF token generated by the PHP API - yes, but to get the token in the app, I still have to make a request to the API, which again is visible and can be duplicated/manipulated.
- Uglify the js files, which is good for production, but it's not bringing the real security I want.
So the question is - how to secure my PHP API from unauthorized AJAX calls and allow only calls from my application?