I'm developing a Cordova app and I've got the UI ready but I need data to my app from a database. For example I want my cordova app to include user authentication when the user opens the app which means, I have to access my database in some way to check the user input. I would also like to get data from the database and show in the app such as the members information, ranking and so on. How do I do this in a easy and proper way? Am I right when I say that there is not a good thing to access a database directly from the javascript in the cordova app, for security reasons?

Is the solution through a architecture that looks like this?

Cordova app(In Google play) --> Application Server --> Database

1 Answer 1


Your proposed solution is the most typical and commended strategy, yes. Use HTTPS for the secure communication, proper server-side checks for other aspects of security (and not saving plain-text usernames and passwords on the device for yet another consideration of security). Direct access of the database on the server is "not done", mostly because the database applications are not designed for such a use case either in terms of usability, tool/library support, or security.

Your application server and database can be pretty much anything you want it to be, as through an app you will most likely use something like REST (or old-fashioned GET/POST without the fancy bits) to access it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.