Hi guys,
I’m looking to build an app which interfaces with an existing intranet system which has been built using php/mysql, and I have a general question about the approach if that’s okay!
I have looked at many tutorials and guides, and feel that the best way would be to use Back& as my database interface, which syncs to the existing mysql database.
I’m having trouble with approaching the login system for the app.
this link shows a great tutorial of building a basic authentication system for the app however, it doesn’t deal with any server-side logging in - ie checking the entered credentials against records in a ‘login’ table in the mysql (back&) database.
this is the login function from the tutorial, as you can see it’s checking against static username/password combinations
var login = function(name, pw) { return $q(function(resolve, reject) { if ((name == 'admin' && pw == '1') || (name == 'user' && pw == '1')) { // Make a request and receive your auth token from your server storeUserCredentials(name + '.yourServerToken'); resolve('Login success.'); } else { reject('Login Failed.'); } }); };
Once the user is logged in, the app’s pages will need to return records from the database which belong to that userID, for example to-do items owned by userID:1
Some guidance on this would be appreciated.
Thank you!