Comments (3)
@sevilayha I am at work right now, I will get to it later today!
from easy-node-authentication.
@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.
- 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
}
};
- 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
},
- 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.
@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)
- README Git location error HOT 1
- Reason for /connect/... routes
- Problems Linking a Local Account & No cleanup when linking HOT 1
- Authorization code expires in facebook ,what to do HOT 1
- Email Id is undefined in Facebook login
- Race condition issue?
- Undefined variables
- Is it still valid for use for today's standards ? HOT 6
- Google Authentication Not Working HOT 4
- Update to express 4 HOT 1
- Critical Security Flaw - Mongoose Model inside Webtoken HOT 3
- Twitter Authentication / Authorization HOT 2
- [Security Flaw] Tokens saved to Database in cleartext are vulnerable to attack HOT 2
- broken without error messages.
- facebook/twitter/google authetication is not working
- local authentication not working! HOT 1
- DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0
- MongoError: connection 0 to localhost:8081 closed at Function.MongoError.create HOT 1
- Congratulations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easy-node-authentication.