Sign-Up with Facebook, Twitter and Google using Node.js and MongoDB

Table of contents
Reading Time: < 1 minute

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.

Screenshot from 2014-03-22 10:52:55

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.

Written by 

Ayush is the Sr. Lead Consultant @ Knoldus Software LLP. In his 10 years of experience he has become a developer with proven experience in architecting and developing web applications. Ayush has a Masters in Computer Application from U.P. Technical University, Ayush is a strong-willed and self-motivated professional who takes deep care in adhering to quality norms within projects. He is capable of managing challenging projects with remarkable deadline sensitivity without compromising code quality.

3 thoughts on “Sign-Up with Facebook, Twitter and Google using Node.js and MongoDB1 min read

  1. Can anyone guide me to write unit test code for passport-google-oauth2 authentication.!!!!

Comments are closed.