I’m building an App who access a MySQL database from my server, and I’m sending the data from the app and receiving the PHP response from the server. I’m trying to create a Login system for this App using this database.
What’s the process? What’s the best practice for build this?
You will have to store some kind of session value in your app and send it with your requests. You may be able to utilize PHP sessions to do this, but what I usually prefer to do is create database entries for API keys. On a successful login an API key is generated for that user and stored on the device. Then on each request you will pass the username/api key combination for authentication on the server side. This method will easily port over if you wish to expand your codebase into android/blackberry/toaster ovens. It makes for a very portable authentication system. Also, this keeps you from having to store the password on the device, which is a security concern.
This is how one programmer chooses to do it.