Ionic Login Session
Ionic Login Session - Create users, login, logout, save sessions, reset password
- iOS, Android
- 5 years ago
- 1 year ago
Ionic Session Login - A barebone full stack application that takes the pain away from creating user accounts, login, logout and session saving. It uses Node, Express, MySQL, Sequelize on the backend and Ionic on the Frontend. Save time and quickstart your app development with this awesome starter kit!
It can easily be modified to use MongoDB or some other DB system. This application creates user accounts from emails and passwords. Passwords are encoded with crypto.
This application does not send or verify emails. It simply creates the accounts. It uses emails as usernames to verify they are unique. This can be easily changed to allow both email and username login.
If you need social oauth login as well then check out my other starter Ionic Social Login Oauth
Check out my other useful starters are here: Great Ionic Starters.
- Create Users
- Prevent duplicate accounts
- Encrypt Passwords
- Save Login Session
- Password Reset (New)
The server dependencies:
- "body-parser": "~1.12.4",
- "connect": "^3.4.0",
- "cookie-parser": "~1.3.5",
- "debug": "~2.2.0",
- "express": "~4.12.4",
- "express-session": "^1.12.1",
- "morgan": "~1.5.3",
- "mysql": "^2.9.0",
- "node-gyp": "^3.2.1",
- "q": "^1.4.1",
- "sequelize": "^3.14.1",
- "serve-favicon": "~2.2.1",
- "jade": "~1.9.2"
- Go to the Server folder
- Install node.js Node.js Installation
- In the folder run
- Install Express Server
npm install express --save
- Install Express Session
npm install express-session
- Install Connect
npm install connect
- Download & Install MySQL
- Create a db: 'mydbname' (you can change this).
- To create the db you can run
mysql -u root -e "create database mydbname";
- In Server
app.jsyou have to update your own mysql parameters: dbname , user, password, url and port.
npm install mysql
- Install Sequelize
npm install sequelize
- Install mysql option
npm install --save mysql
- Install nodemailer
npm install nodemailer
- Start server with
Usage via http post
- Install Ionic
- Download Genymotion if you plan to emulate on android
- open Frontend folder in terminal
- Install Ionic
sudo npm install -g ionic
- add platforms
ionic platform add ios
- add platforms
ionic platform add android
ionic emulate ios(do not run with livereload)
ionic run android(after you start genymotion emulator instance)
Running as a website
- [Enable CORS requests](http: ubberchickin.com/origin-is-not-allowed-by-access-control-allow-origin-ionic/)
Password Reset Setup
- You will have to set up your nodemailer to send emails with the password reset token
- Check https://github.com/nodemailer/nodemailer on how to setup your mail service
Node.js App Deployment Tutorial
- It is highly recommended you use Heroku.com as your app hosting service
- Read my tutorial on [How to Deploy Node.js app to Heroku](http: ubberchickin.com/how-to-deploy-your-ionic-node-js-app-to-heroku/)
- If you're using Android Emulator or testing on a Smartphone, you cannot access your computer's localhost. In the
Frontend/www/js/services.jsyou have to replace all the
localhostreferences with your computer external ip such as
192.x.x.x. Find out what your computer's IP is and put it instead of localhost. Make sure the smartphone and your computer are on the same wifi network or your server is accessible globally.
- If you try to run with
ionic run -lyou will encounter Cross Origin Issues (CORS). You can read about it here.
- The payment on this site is processed by Stripe.com and sometimes your bank will decline the charges if they don't recognize it. You can contact your bank or try a different card.
- Leave a comment if you get stuck on anything
- If you email me directly it might get caught in the spam filter
- And Kudos if you leave a Rating! =)
Stay in Touch
- Check out my blog rubberchickin.com.