MEAN Stack : Authentication with Passport 3 (Facebook / Twitter Login)
This tutorial is not much different from the previous ones except we'll try to login with Facebook/Twitter:
In this tutorial, we will choose Passport to handle social login for us, as it provides different modules for a variety of OAuth providers, such as Facebook, Twitter, or Google. So, we will be using the passport-facebook and passport-twitter modules to provide login functionality via existing Facebook or Twitter accounts.
This tutorial is not complete, and still more things to do.
After redirecting port 80 to 3000, we can just use epicmath.com rather than adding port number as in epicmath.com:3000:
$ sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
Here is the Basic Settings:
Advanced Settings:
Select "Login with Facebook":
We're now logged in:
Source : https://github.com/epic-math/NodeJS-Facebook-Twitter.
Things to be fixed: getting user info from Facebook!
If we want to make it to run as a daemon, we can use forever:
ubuntu@ip-172-31-25-188:~/passport-social$ forever start bin/www warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: www
Node.JS
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization