Last week, we created a simple login application, which has sign up and login facility after successfully registration.
Now we have added one more feature, i.e. Sign-up with Facebook, Twitter and Google. You can login with your facebook, twitter and google account.
We’ll be adding some more features in this application very soon such as birthday reminder functionality.
We have used Passport[authentication middleware for Node.js] strategy for authentication.
To use this application, Pull the code from https://github.com/knoldus/Node.js_UserLogin_Template. You have to create Facebook, Twitter and Google App.
After that Go to /config/passport.js
Add API Key and Secret Key in below variables:-
Now run below commands:-
When you would login with your Facebook/Google, user’s data such as name and email would be stored in MongoDB. Since, Twitter doesn’t return user’s email address. So only user’s name would be store in MongoDB.