First off, I'm no pro.
In my quest to become a better developer I am trying to understand what is needed and how to accomplish creating a sign-up/login for an Ionic-Framework app.
Most of the single-page-applications (SPAs) handle authentication on a node server that is also serving up the HTML for the client. In my case the phone itself will be serving up the HTML so I am guessing I may be going up against some CORs issues.
I understand that the Ionic-Framework uses states and based angular-client-side-auth repo I should be authenticating whenever I am changing states in my app.
I have an initial app setup but now I am kind of confused where to go from here.
The tools I have at my disposal:
Questions of mine:
Thanks for helping me become a better developer.
nathvarun gave a very complete answer, but I'd like to share the steps I do for authentication in my app.
email
+ password
via ajax to the servertoken
in the server and send it back to the appemail
+ token
in localStorage
email
+ token
via POST
true
the method is executed, if false
I send back to the app an error (401)Nice thing is that when the app is open, you can get the email
+ token
from localStorage
, send to the server, if that token is ok for that user, redirect to main screen, otherwise redirect to login. Then whenever user clears the cache of the app, he is redirected to login screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With