Hi I am just planning my server login security for a mobile app and have made notes of a simple plan. Does it look secure, and can it be improved in any way? Thanks in advance.
Client login for the first time
- Get device id from client and send to server.
- Create a MD5 salt on the server and user account with new user ID.
- Concatenate the salt with the device ID and User ID to create the salted password.
- Create a MD5 Hash of the salted password and store the hash password in the database.
- Return the user ID and Salt to the client.
Clients login again or makes a general request
- Send request to server with MD5 hash generated by the client using the salt received from server and concatenating with the device ID and User ID. Also send the device ID and user ID in plain text.
- Verify the user device ID and user ID stored in the database are the same as sent by the client.
- Verify that MD5 hash sent by the user is the same as the hash stored in the database for that users device.
- Validate and continue with processing the request.