Skip to content

Commit

Permalink
remove facebook auth
Browse files Browse the repository at this point in the history
  • Loading branch information
madhums committed Mar 13, 2019
1 parent 219aa0c commit 6df7a97
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 104 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FACEBOOK_CLIENTID=<ID>
FACEBOOK_SECRET=<SECRET>
TWITTER_CLIENTID=<ID>
TWITTER_SECRET=<SECRET>
GITHUB_CLIENTID=<ID>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ npm start

Then visit [http://localhost:3000/](http://localhost:3000/)

**NOTE:** Do not forget to set the facebook, twitter, google, linkedin and github `CLIENT_ID`s and `SECRET`s. In `development` env, you can set the env variables in `.env` and replace the values there. In `production` env, it is not safe to keep the ids and secrets in a file, so you need to set it up via commandline. If you are using heroku checkout how environment variables are set [here](https://devcenter.heroku.com/articles/config-vars).
**NOTE:** Do not forget to set the twitter, google, linkedin and github `CLIENT_ID`s and `SECRET`s. In `development` env, you can set the env variables in `.env` and replace the values there. In `production` env, it is not safe to keep the ids and secrets in a file, so you need to set it up via commandline. If you are using heroku checkout how environment variables are set [here](https://devcenter.heroku.com/articles/config-vars).

## Tests

Expand Down
3 changes: 1 addition & 2 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const mongoose = require('mongoose');
const crypto = require('crypto');

const Schema = mongoose.Schema;
const oAuthTypes = ['github', 'twitter', 'facebook', 'google', 'linkedin'];
const oAuthTypes = ['github', 'twitter', 'google', 'linkedin'];

/**
* User Schema
Expand All @@ -22,7 +22,6 @@ const UserSchema = new Schema({
hashed_password: { type: String, default: '' },
salt: { type: String, default: '' },
authToken: { type: String, default: '' },
facebook: {},
twitter: {},
github: {},
google: {},
Expand Down
3 changes: 0 additions & 3 deletions app/views/users/auth.pug
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ block main

block content
.text-center.my-4
a(href="/auth/facebook")
i.fa.fa-facebook.fa-3x.mx-3
| &nbsp;&nbsp;
a(href="/auth/github")
i.fa.fa-github.fa-3x.mx-3
| &nbsp;&nbsp;
Expand Down
5 changes: 0 additions & 5 deletions config/env/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

module.exports = {
db: process.env.MONGODB_URL || 'mongodb://localhost/noobjs_dev',
facebook: {
clientID: process.env.FACEBOOK_CLIENTID,
clientSecret: process.env.FACEBOOK_SECRET,
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: process.env.TWITTER_CLIENTID,
clientSecret: process.env.TWITTER_SECRET,
Expand Down
6 changes: 0 additions & 6 deletions config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

module.exports = {
db: process.env.MONGOHQ_URL,
facebook: {
clientID: process.env.FACEBOOK_CLIENTID,
clientSecret: process.env.FACEBOOK_SECRET,
callbackURL:
'https://nodejs-express-demo.herokuapp.com/auth/facebook/callback'
},
twitter: {
clientID: process.env.TWITTER_CLIENTID,
clientSecret: process.env.TWITTER_SECRET,
Expand Down
5 changes: 0 additions & 5 deletions config/env/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

module.exports = {
db: process.env.MONGODB_URL || 'mongodb://localhost/noobjs_test',
facebook: {
clientID: process.env.FACEBOOK_CLIENTID,
clientSecret: process.env.FACEBOOK_SECRET,
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: process.env.TWITTER_CLIENTID,
clientSecret: process.env.TWITTER_SECRET,
Expand Down
2 changes: 0 additions & 2 deletions config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const User = mongoose.model('User');

const local = require('./passport/local');
const google = require('./passport/google');
const facebook = require('./passport/facebook');
const twitter = require('./passport/twitter');
const linkedin = require('./passport/linkedin');
const github = require('./passport/github');
Expand All @@ -28,7 +27,6 @@ module.exports = function(passport) {
// use these strategies
passport.use(local);
passport.use(google);
passport.use(facebook);
passport.use(twitter);
passport.use(linkedin);
passport.use(github);
Expand Down
45 changes: 0 additions & 45 deletions config/passport/facebook.js

This file was deleted.

13 changes: 0 additions & 13 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ module.exports = function(app, passport) {
users.session
);
app.get('/users/:userId', users.show);
app.get(
'/auth/facebook',
pauth('facebook', {
scope: ['email', 'user_about_me'],
failureRedirect: '/login'
}),
users.signin
);
app.get(
'/auth/facebook/callback',
pauth('facebook', fail),
users.authCallback
);
app.get('/auth/github', pauth('github', fail), users.signin);
app.get('/auth/github/callback', pauth('github', fail), users.authCallback);
app.get('/auth/twitter', pauth('twitter', fail), users.signin);
Expand Down
49 changes: 30 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"notifier": "~0.2.0",
"only": "0.0.2",
"passport": "~0.4.0",
"passport-facebook": "~3.0.0",
"passport-github": "~1.1.0",
"passport-google-oauth": "~2.0.0",
"passport-linkedin": "~1.0.0",
Expand Down

0 comments on commit 6df7a97

Please sign in to comment.