How to create a login system

Any tips on creating a login system? on Username and Password comparison on a remote database? db is in MySQL

If you’re sending the data to a remote server, encrypt before sending. Also consider using HTTPS for extra security.

Depending on what’s on the remote, search Google for PHP/ASP-based systems and use one of those on the server-side, then you just need to send the data from your client application and listen for the response.

so basically I will send my username and password in encrypted mode, then the remote server will check if the username and password matches. Then the device will just receive a confirmation and it can now proceed?

Here’s what I see

Device Send Username Password --> Server checks – > If yes server sends confirmation to device -->device receives confirmation --> device has now have the authorisation to use the app.

That’s it in a nutshell, however the server should ALWAYS send a response, either positive or negative. if you don’t respond, the client could wait (in principle) forever for the server to get back to it.

The client should probably have some form of time-out set so if the server doesn’t respond it’s treated as an error condition something like:

Send details to server

Wait until (timeout is reached)  or (server sends response)

If timeout is reached

        Flag an error and inform the user
       Deal with the error condition

else if a response has been received

       If the response is positive
              Allow the user access

       else

              Throw an incorrect username/password condition

       end

end

Not the greatest pseudocode in the world but you get the idea :slight_smile:

yah got it :slight_smile: thanks dude heheh :))  :ph34r:

BTW in what form is the confirmation? is it in JSON? or just plain simple string variable?

It’ll come in whatever form you want or whatever form the server-side code returns it in - like i said, check out some of the pre-written stuff via Google - it should tell you how it returns it’s data…  

The only thing is I don’t know how to send data to the server :frowning: sorry from mobile to server, but I can retrieve data from the server via JSON http://coronalabs.com/blog/2012/11/20/how-to-download-json-data-from-mysql-using-corona-sdk/

nvm i got it how to communicate with remote server thanks a lot though :slight_smile:

If you’re sending the data to a remote server, encrypt before sending. Also consider using HTTPS for extra security.

Depending on what’s on the remote, search Google for PHP/ASP-based systems and use one of those on the server-side, then you just need to send the data from your client application and listen for the response.

so basically I will send my username and password in encrypted mode, then the remote server will check if the username and password matches. Then the device will just receive a confirmation and it can now proceed?

Here’s what I see

Device Send Username Password --> Server checks – > If yes server sends confirmation to device -->device receives confirmation --> device has now have the authorisation to use the app.

That’s it in a nutshell, however the server should ALWAYS send a response, either positive or negative. if you don’t respond, the client could wait (in principle) forever for the server to get back to it.

The client should probably have some form of time-out set so if the server doesn’t respond it’s treated as an error condition something like:

Send details to server

Wait until (timeout is reached)  or (server sends response)

If timeout is reached

        Flag an error and inform the user
       Deal with the error condition

else if a response has been received

       If the response is positive
              Allow the user access

       else

              Throw an incorrect username/password condition

       end

end

Not the greatest pseudocode in the world but you get the idea :slight_smile:

yah got it :slight_smile: thanks dude heheh :))  :ph34r:

BTW in what form is the confirmation? is it in JSON? or just plain simple string variable?

It’ll come in whatever form you want or whatever form the server-side code returns it in - like i said, check out some of the pre-written stuff via Google - it should tell you how it returns it’s data…  

The only thing is I don’t know how to send data to the server :frowning: sorry from mobile to server, but I can retrieve data from the server via JSON http://coronalabs.com/blog/2012/11/20/how-to-download-json-data-from-mysql-using-corona-sdk/

nvm i got it how to communicate with remote server thanks a lot though :slight_smile:

I’ve done an app recently which requires login. Here are few tips I would like to add to this topic

1> use https connection to send and receive data.

2> use POST  in network request instead of GET. I used GET in my app and Apache was recording query string(&password=123123). By default Apache doesn’t record POST parameter.

3> from device pass unique key and check from your server that’s the request is from your App.

4> working with json seems to easy to work. I uses Rob’s  function to save and load json file into lua table. (Thank you Rob)

5> always check networking connection before network request. I use Rob’s code found in the business app. (Thank you Rob)

6> encrypting parameter… I’ve not done myself yet but will do in the next release

7> in the server end make sure you catch all errors and time to time review logs