passport-local

passport.js session lost after redirect

这一生的挚爱 提交于 2021-02-19 05:42:08
问题 I am trying to integrate passport into my node.js app. app.js file const app = express(); app.set('view engine', 'pug'); app.use('/libs', express.static('node_modules')); require('../config/auth.config')(app, data, passport); app.use((req, res, next) => { res.locals.user = req.user; next(); }); app.get('/', (req, res) => { // those objects are populated correctly after redirect from auth middleware console.log(req.session) console.log(req.user) return res.render('home'); }); app.get('/login',

passport.authenticate - username and password are null

此生再无相见时 提交于 2021-02-10 11:54:09
问题 this is probably some basic mistake but I am watching tutorial and even though I think I done everything exactly like I should after submitting login form I am redirected to the "failureRedirect" page. When I looked at source code in passport module I something. After this: Strategy.prototype.authenticate = function(req, options) { options = options || {}; var username = lookup(req.body, this._usernameField) || lookup(req.query, this._usernameField); var password = lookup(req.body, this.

My express.js and passport.js middleware are all working and are being called, but the page does not redirect

风流意气都作罢 提交于 2021-01-29 14:26:19
问题 I am currently developing a node/express server, and I decided to use passport-local for user authentication along with a local MongoDB server. I am using a POST method from an html form to send the two items, an email and a password (I changed the usernameField item in my instance of LocalStrategy). Using console.log's, I've seen all of the correct and expected behavior from Mongo and Passport. However, the page never redirects with successRedirect or failureRedirect. It looks like the html

Passport local strategy auth seems to only work on localhost with a shared MongoDB instance

冷暖自知 提交于 2021-01-28 14:06:37
问题 This is a weird one, but I'm not sure what else could be going on. I've successfully deployed the passport-local strategy for a Node.js Express app with user accounts stored in MongoDB. I'm using Mongo as a service via MongoLab. My accounts and login auth works as expected locally. But when I deploy my app to AWS (using the same Mongo service still), the same account credentials fail. I'm wondering... is Passport somehow using the URL, port, or other environment-specific information to

passport-local-mongoose Error message change

无人久伴 提交于 2021-01-28 04:34:03
问题 I want to change my Error Messages with the passport local mongoose middleware. but it didn't work: var mongoose = require('mongoose'); var Schema = mongoose.Schema; var passportLocalMongoose = require('passport-local-mongoose'); var Account = new Schema({ username: String, email: String }); Account.plugin(passportLocalMongoose,{ IncorrectUsernameError: 'sdfsd', IncorrectPasswordError: 'sdfsd' }); var User = mongoose.model('Account', Account); module.exports = User; thats my Account.js and

NestJS Authentification with JWT Passport not working

六月ゝ 毕业季﹏ 提交于 2020-05-16 03:15:33
问题 I am trying to set up a very simple login system using jwt-passport with nestjs. I followed this tutorial: https://docs.nestjs.com/techniques/authentication but I just can't get it to work. I am really new to this stuff and would appreciate if anyone can show me the way. The way I send the login to the server: this.clientAuthService.login(this.userName, this.password).then(response => { this.clientAuthService.setToken(response.access_token); this.router.navigate(['/backend']); }); My