PHP User Authentication

Hi,

I am currently trying to develop an application with Ionic, and I am struggling to find a way to create a user login. I have searched around a lot, and I keep coming across people suggesting Node.js, and codeignitor. I have no experience whatsoever with either of these, and I am not sure how to implement them, so I am looking to find a way to do it using PHP if possible.

I have also come across auth0, but it costs money for multiple users, so would not be a good solution in the long run.

If I was to create a login using PHP and HTTP requests, would I still be able to use login tokens to keep the user logged in after the app is closed? If so, how would I be able to do that?

The Database I am using is MySQL.

Any help or links to tutorials would be much appreciated.

I’ve had the same question and made this topic:

if its not only php you want to use check out http://strongloop.com/ | http://docs.strongloop.com/ i’m sure you will love it even thing u need

Did you manage to get a solution to your problem by any chance?

yes i build key and value pairs which I send to the server on every request a user makes that needs authentication. i’m probably gonna build it out somemore with time-leases that renew everytime the user starts or resumes my application but I don’t think I need that kind of protection for now so i’m focused on some other stuff.

Did you follow a tutorial or were you able to figure it out yourself? If you used a tutorial I’d really appreciate a link :smiley:

It’s a lot like how you would create a restore my password function on a website with an email that gives you a link where you can fill in a new one, or how payment systems give return a payment id and a hash that only you know and can check against values in the database.

If I was to create a login using PHP and HTTP requests, would I still be able to use login tokens to keep the user logged in after the app is closed? If so, how would I be able to do that?

Either local storage or use cordova
I find using localstorage sufficient
look up angular localstorage there are plenty of libraries for accessing that

Look into basic authorization, I find it simple yet more useful since you can just place your saved authorization tokens in the header and be done with it

1 Like

Thanks for the info, I appreciate it!

If I use local storage, will that make me be able to access the username across all screens of the app?

First, Local Storage persists data by domain but browse pages(see this topic).

Second, it is better to persist user authenticated credentials(e.g. auth token) in your Local Storage, and then fetch user information via credentials with some angular service.