passport.js

if(err) throw err; Error: Illegal arguments: string, undefined

邮差的信 提交于 2019-12-12 17:08:26
问题 I now have module.exports.comparePassword = function(candidatePassword, hash, callback) { console.log(candidatePassword) console.log(hash) bcrypt.compare(candidatePassword, hash, function(err, ismatch) { if(err) throw err; callback(null, ismatch); }); } and the logs now are Server is up on port 3000 Connection has been established Sat Jan 13 2018 14:45:36 GMT+0000 (GMT): GET /users/login Sat Jan 13 2018 14:45:42 GMT+0000 (GMT): POST /users/login testing1234 undefined /Users/benbagley/Code

Node Passport-facebook login in Facebook Page Tab application

蓝咒 提交于 2019-12-12 16:21:40
问题 I'm developing a web application in NodeJS and AngularJS, that is a PageTab application to facebook. For the login I'm using the library Passport-facebook. My middleware is: passport.authenticate('facebook', { display: 'popup', scope: ['read_stream', 'publish_actions', 'email', 'user_photos'] }) The application works if i'm outside the tab of facebook, but when I try into facebook tab, I get an error: [Error] Refused to display'Http....'in a frame because it set 'X-Frame-Options' to 'DENY'.

passport jwt verify callback not called

元气小坏坏 提交于 2019-12-12 15:03:43
问题 I'm using passport-jwt package for simple authentication and the token is generated by jsonwebtoken. But the problem is that verify callback is never called. Here my passport.js code. var JwtStrategy = require('passport-jwt').Strategy; var User = require('../app/models/user'); var config = require('../config/database'); var opts = {}; opts.jwtFromRequest = function(req) { var token = null; if (req && req.headers) { token = req.headers.authorization; } return token; }; opts.secretOrKey =

Problems getting Passport.js to authenticate user

萝らか妹 提交于 2019-12-12 12:36:54
问题 I am unable to get Passport to authenticate my user. For some reason the passport.authenticate method always fails. What I don't understand is that if I add middleware before the passport call, the user data is accessible via req.user . Any ideas to why passport.authenticate is failing? app.get('/app' // MY USER SHOWS UP HERE , function(req, res, next) { console.log("app.get('/app')", req.user); next(); } // DOESN'T MAKE IT PAST HERE , passport.authenticate('local', { failureRedirect: '/login

Mean.js req.isAuthenticated is showing fail?

时光怂恿深爱的人放手 提交于 2019-12-12 10:46:16
问题 i have downloaded meanjs version@0.1.12.here i have used two servers for front end i hvae used angular with ionic its running in localhost:3000,for backend i have used meanjs.in that meanjs i have created signup,signin and articles.when ever i am using meansjs as a backend and front end it's working fine .but when i connect to another server(localhost:3000) signup and signin working fine but when ever i am creating articles i am getting 401 unauthorized bcoz of that req.isAuthenticated()

Google-oauth2 passport not working

邮差的信 提交于 2019-12-12 10:21:55
问题 I am trying to implement sign-in with google and passport but I am running into a bit of a problem. I successfully authenticate with google, but my data isn't being passed to the front end. I Haven't changed anything from the original code except for the URI and necessary client id and secret. Can anyone tell me what I am missing? var express = require( 'express' ) , app = express() , server = require( 'http' ).createServer( app ) , passport = require( 'passport' ) , util = require( 'util' )

Using Everyauth/Passport.js to authenticate with Twitter whilst asking for username/email/password

我们两清 提交于 2019-12-12 10:19:06
问题 I want to create an authentication system whereby the user can "sign up with Twitter", but all this effectively does is authenticate their Twitter account and prefills a registration form with their Twitter username. The user will then be asked to enter an email and password (or an alternative username). Thus, upon registration, the user has authenticated access to their Twitter account, and the access token can be stored in a database. Later down the line I will use this to access the

req.session.passport and req.user blank , and req.isAuthenticated returns false after initial successful login using passport-facebook

妖精的绣舞 提交于 2019-12-12 08:37:25
问题 After the initial successful login from Facebook and login redirection callback using passport-facebook 1.0.3 and express 4.6.1,req.session.passport and req.user contains the value set during the serialize call(which i get from the stragegy) , but on subsequent visits to different routes on the site the req.session.passport and req.user is blank , and req.isAuthenticated() returns false , so after the initial successful login from FB the ensureAuthentication method on all other routes fails .

Node.js Authentication with Passport: How to flash a message if a field is missing?

我的梦境 提交于 2019-12-12 08:23:27
问题 I am using passport.js and I'd like to flash a message if the fields of my form are empty. But I don't know how to do it since passport doesn't trigger the strategy callback if those are missing. I really want this use case to be more clear, and I don't want to modify passport. I feel like there is a way to do so but I don't know where! I've tried to use the callback of the route ( app.post ) but it doesn't seem to work the way I tried. Here is the authenticate function prototype: Strategy

How to use subscriptions-transport-ws with passport and express-session

陌路散爱 提交于 2019-12-12 08:14:39
问题 I'm using a passport local strategy that works well with express: passport.use(localStrategy); passport.serializeUser((user, done) => done(null, JSON.stringify(user))); passport.deserializeUser((obj, done) => done(null, JSON.parse(obj))); app.use(passport.initialize()); app.use(passport.session()); This localStrategy is doing a Mongoose call to get the user based on his pubKey and I guess that request.user is populated by this way. I setup my graphql endpoint like this: app.use('/graphql',