- passport
- passport-facebook
- passport-google-oauth20
- passport-twitter
- PostgreSQL
- pg-promise
- bluebird
- express-session
- connect-pg-simple
- connect-flash
- Go here: https://developers.facebook.com/
- Go to "Add a New App"
- Go to Settings > Basic
- Under App Domains, put in your App Domain or localhost
- Add Platform > Website
- App Review > Make your App public
- Go to Dashboard > Click Show to get your App ID (Client ID) and App Secret (Client Secret)
- Go here: https://apps.twitter.com/
- Go to Create New App
- Once you finish you will get a Consumer Key and Consumer Secret
- Go to the Google Developers Console: https://console.developers.google.com/
- Create a Project
- Go to Credentials > Create Credentials > OAuth Client ID > Web application
- Once you Create, you will receive a Client ID and Client Secret
- Lastly, go to Library > Social APIs > Google+ API (enable this API)
- passport: http://passportjs.org/
- passport-facebook: https://github.com/jaredhanson/passport-facebook
- passport-twitter: https://github.com/jaredhanson/passport-twitter
- passport-google-oauth20: https://github.com/jaredhanson/passport-google-oauth2
- express-session: https://github.com/expressjs/session
- connect-pg-simple: https://github.com/voxpelli/node-connect-pg-simple
- Git clone this project
- Open up Terminal or Command line
- Navigate to the directory where the project was cloned to
- Run this command: psql -f ./config/db/schema.sql
- This command will create a PostgreSQL database along with the tables
- Setup environment variables:
- Create .env file in your project root with these variables
DATABASE_URL=postgres://localhost:5432/oauthsocial_app
SECRET_KEY=38219ejhhsd@#$%$@^$#%Cdviroirer
FB_CLIENT_ID=xxxxxxxxxxxxxxxxxxxx
FB_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxx
FB_CALLBACK=................/facebook/callback
TW_CONSUMER_KEY=xxxxxxxxxxxxxxxxxxxx
TW_CONSUMER_SECRET=xxxxxxxxxxxxxxxxxxxx
TW_CALLBACK=................/twitter/callback
G_CLIENT_ID=xxxxxxxxxxxxxxxxxxxx
G_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxx
G_CALLBACK=................/google/oauth2callback
- Now create the session table for tracking sessions in your database by running this command to create a new table:
psql [mydatabase] < node_modules/connect-pg-simple/table.sql
- To run the application, you need to install the dependencies, run this command: npm install --save
- To start the application, run this command: npm start
- The application will run at: localhost:3000, if that port is already in use, run this command: PORT=1738 npm start
- This command will start the server at: localhost:1738