passport-local

Simple Auth With Passport-Local and deSerializeUser problem

我的未来我决定 提交于 2019-12-21 22:21:08
问题 After reading an excellent description here on how deserialize and serialize user works in the Passport flow Understanding passport serialize deserialize I'm concerned about the performance impact of having deSerializeUser called on every request. All the examples I've seen (see below for one) have deserializeUser calling what looks like a database User.findById to do that work. Assuming you are not using a cdn for all your assets, that means many many database calls on every page load. My

Passport Authenticate doesn't redirect

别说谁变了你拦得住时间么 提交于 2019-12-20 06:06:10
问题 I was writing a local-signup strategy and noticed that it doesn't work so I stepped back and tried to authenticate against my empty collection. Every time I submit the form it takes ~30-40s until it results in a timeout. I ensured passport.authenticate() is called but it seems ike it's not doing any redirects and hence it is timing out because I am not rendering something either. Questions: I expected that it would do a redirect to the failureUrl (which is '/signup'), but instead nothing is

Passport authentication not working in sails.js application

℡╲_俬逩灬. 提交于 2019-12-18 21:26:33
问题 I have a Sails JS application. I am trying to setup authentication using Passport.js authentication layer sails-generate-auth. I have configured my app by following the steps given in their documentation. But when I lift my sails app, authentication is not working. I am able to access the controllers, even when I am not logged in (It's not redirecting to my login page). I added a console.log statement in api/policies/passport.js as follows: module.exports = function (req, res, next) {

Update logged in user details in session

瘦欲@ 提交于 2019-12-18 14:15:19
问题 I am using PassportJS with ExpressJS. I need to update the logged in user details. While I do update this in the DB, how do I update it in the session too so that request.user contains the updated user details? That is, after updating the database, how do I update the session info on the user as well? I tried directly assigning the updated details to request.user but it did not work. I then tried request.session.passport.user - this worked but there is a delay of around 5 to 10 seconds before

isAuthenticated() function not working node.js passport

≡放荡痞女 提交于 2019-12-13 17:14:45
问题 I am creating online course application and I want only authenticated users to see the course details and course lecture. I am using local strategy of passport authentication for user authentication. I added isAuthenticated in my routes, however, still the unauthenticated users can view the video lectures. Here is my routes file. file name:- courses.server.routes.js 'use strict'; /** * Module dependencies */ var coursesPolicy = require('../policies/courses.server.policy'), courses = require('

Browser Back Button doesn't destroy the session in PassportJS + ExpressJS. How to kill/terminate the session entirely?

前提是你 提交于 2019-12-12 23:28:36
问题 The code for my Logout Mechanism is app.get('/logout', isLoggedIn, function(req, res) { req.logout(); res.redirect('/'); }); Am using a Express-session package using a secret key, haven't set Cookies anywhere. While I click the browser Back button after logout, It still allows the user to go back to the page being authenticated. How do I terminate this session entirely? isLoggedIn is just authenticating via PassportJS's isAuthenticated method. What is the way out here? Please help. Thanks in

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()

Authentication is returning “401 (Unauthorized)” when it shouldn't

一世执手 提交于 2019-12-12 08:51:02
问题 I am setting up an authentication functionality for my first time and am getting some unexpected results after a user has been logged in. A colleague has given me an application with working authentication to model my application after and it seems like everything I have done is correct. I am using AngularJS on the front-end, SailsJS back-end framework, and PassportJS authentication middleware. My source is (for now) stored publicly... the backend API is on Github here (API Github) and the

Passportjs not saving user into session after login

a 夏天 提交于 2019-12-12 04:25:33
问题 I'm working on a simple social network and I want users to register and log in locally trough passport.js. I was following thistutorial and all code runs with no errors. However when I try to log in User passes the authentication but doesn't stay in session when I print req.session on index route. Here is my passport config file: var LocalStrategy = require('passport-local').Strategy; var User = require('../server/models/User.js'); module.exports = function(passport){ passport.serializeUser

Mongoose “Create” method - Is there no callback? (Using passport and angular)

≡放荡痞女 提交于 2019-12-11 14:53:12
问题 I am using mongoose to create a user object on register. This works fine and any errors are returned as expected. However, I want to log the user on right after they register (so registering logs you on if there are no errors). I have the following for the register. register_controller: $scope.submitRegister = function() { AuthenticationService.register(this.details).success(function() { $log.debug('/POST to /api/register worked'); }); } services.js: .service('AuthenticationService', function