Coder Social home page Coder Social logo

Comments (3)

falansari avatar falansari commented on August 15, 2024 1

@sevilayha I am at work right now, I will get to it later today!

from easy-node-authentication.

falansari avatar falansari commented on August 15, 2024

@libnine #53 I had the same issue. The issue is two fold: one it's been a few years and the FB API has changes that affect this code. And two, there is a small issue with the model, probably caused by issue no.1.

  1. In auth.js, below FB's "callbackURL", add:
module.exports = {

  /* Facebook Authorization */
  'facebookAuth': {
    'clientID': 'yourclientid',
    'clientSecret': 'yourclientsecret',
    'callbackURL': 'http://localhost:3000/auth/facebook/callback', // Change URL to your app
    'profileFields': ['id', 'email', 'name'] // Add permissions as needed. Check FB API docs for what permissions are available
  }
};
  1. In passport.js, fix the new FacebookStrategy:
passport.use(new FacebookStrategy({
    clientID: configAuth.facebookAuth.clientID,
    clientSecret: configAuth.facebookAuth.clientSecret,
    callbackURL: configAuth.facebookAuth.callbackURL,
    profileFields: configAuth.facebookAuth.profileFields,
    enableProof: true, // For security
    passReqToCallback: true // Pass request from route
  },
  1. In user.js schema, make sure the order of your fields is correct:
const UserSchema = mongoose.Schema({
  local: {
    email: String,
    password: String
  },
  facebook: {
    id: String,
    token: String,
    name: String,
    email: String
  }
};

Yeah, the fact that the tutorial has email above name in the schema broke the code! Hopefully, this will be enough to fix your issues and anyone else's :) I'm not sure if I should do a pull request for this? It doesn't seem to be updated anymore.

from easy-node-authentication.

chris-sev avatar chris-sev commented on August 15, 2024

@fatima-alansari Thanks for the insight. A pull request would be great. I'm planning on doing a big update of this and a PR would be a big help.

from easy-node-authentication.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.