FAQ Database Discussion Community


Passport “Hello World” always fails

javascript,node.js,express,passport.js,passport-local
I have the following: import {Router} from 'express'; import passport from 'passport'; import {Strategy} from 'passport-local'; import pg from 'pg'; import {pgUri} from '../environment'; let loginRouter = Router(); passport.use(new Strategy((username, password, done) => done(null, true))); //{ // pg.connectAsync(pgUri) // .then(([client, release]) => { // return client.queryAsync('select * from users where...

Manually call passport for authentication

node.js,passport-local
I develop a restful nodeJS API protected by a oauth2 authentication using passport. var express = require('express'); var passport = require('passport'); var port = process.env.PORT || 8080; var app = express(); app.use(passport.initialize()); // Create our Express router var router = express.Router(); var creatureController = require('./controllers/creature'); router.route('/creature').get(passport.authenticate('accessToken', {session: false}), creatureController.getProfile); In...

req.session.passport and req.user empty, serializeUser and deserializeUser are never called

node.js,session,express,passport.js,passport-local
I'm using Express (v4.11.2) with Passport in order to support multiple providers (local, facebook, twitter and google) for access to the web app I'm building. As a backend I'm using mysql. For now I have two local strategies: local-signup and local-signin. The issue I'm experiencing is that the req.session.passport and...

NodeJS and Passport signup not working - no error

javascript,angularjs,node.js,passport.js,passport-local
I have published the current version on github: https://github.com/rcbgit/boiler The user seems to be "logging in". At least the successful redirect happens with valid username/pw and the failure redirect happens with a bad combo. The problem I'm having is that I don't know how to store the user information after...

redirect to a protected page after login (passport-local - express - nodejs)

node.js,express,passport.js,passport-local
I am trying to show a protected page /enquete (a page that can only be seen by logged in users) after the /login. I am implementing it using passport-local. I have checked the login function returns a user (req.isAuthorized() is true) and it is actually trying to go to /enquete...

How do I correctly call passport.js functions with express router?

javascript,node.js,express,passport.js,passport-local
I'm trying to call the passport.authenticate function as response to post request for my registration view. I've been following this tutorial here to get my head around passport.js and express but having completed the first page of instructions and making the necessary changes for express.js 4.0 every page I try...