passport.js

Password Reset In NodeJS

走远了吗. 提交于 2019-12-31 10:39:21
问题 I have made a set up to update a user's password using NodeJS/Passport. I followed this great guide: http://sahatyalkabov.com/how-to-implement-password-reset-in-nodejs/. 99% of this is working. I had to modify it a bit to include some stripe functionality. I am afraid however I have a critical error somewhere and I cannot find it. The user is currently able to go all the way through the process of having an email sent to them, enter a new password, and be logged in. Another email follows

Passport req.user is undefined when using GitHub strategy

纵然是瞬间 提交于 2019-12-31 03:53:09
问题 I'm trying to set up Github authentication using passport. app.js (where i set up middleware) var createError = require('http-errors'); var express = require('express'); var path = require('path'); var cookieParser = require('cookie-parser'); var logger = require('morgan'); const session = require('express-session'); const passport = require('passport'); const GitHubStrategy = require('passport-github').Strategy; var indexRouter = require('./routes/index'); var app = express(); const helmet =

Why is `req.user` undefined for socket requests in Sails.js, Angular.js and Passport.js?

故事扮演 提交于 2019-12-30 10:48:45
问题 I am trying to get the questions for the current user with a request like this: http://localhost:1337/question/forme As part of the GET request, I am able to access req.user.username and serve the JSONresponse when accessing it from the browser. When I try to make the same Socket.get() request from my Angular client.js file, it doesn't work. I also tried to access it using browser console and it fails for socket.get() requests. 回答1: I spent a large time figuring out all the moving parts to

passport.js - authenticate users from MongoDB with passport-local

我的梦境 提交于 2019-12-30 07:31:29
问题 I have a simple users collection in my MongoDB. I user mongo-native driver. { "email": "johndow@example.com", "password": "123456", "_id": { "$oid": "50658c835b821298d3000001" } } As I user auth via pair email:pass, I re-wrote default passport-local function findByUsername to this: function findByEmail(email, fn) { db.collection("users", function(err, collection) { collection.find({}, {}, function(err, users) { users.each(function(err, user) { if (user.email === email) { return fn(null, user)

how to redirect to original page after successful authentication using passport-google-oauth

元气小坏坏 提交于 2019-12-30 07:09:22
问题 I am using node passport-google-oauth module and trying to redirect the page back to the original path after successful authentication using a session based approached suggested in Custom returnUrl on Node.js Passport's Google strategy. However, I find inside my callback, the redirect info stored in session was always wiped out so I was forced to redirect to a default ('/' in this case). Here is the logging output from my code snippet. It seems when it's inside the callback, the returnTo got

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

家住魔仙堡 提交于 2019-12-30 04:58:25
问题 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 req.user are always empty and that, in fact, serializeUser and deserializeUser are never being called. Here is the setup of express and passport: var bodyParser = require('body

Custom returnUrl on Node.js Passport's Google strategy

佐手、 提交于 2019-12-28 10:06:15
问题 I'm using Express and Passport OpenID Google strategy and I would like to set returnURL on each auth request to be able to return to the page that initiated that auth. The situation is that I have HTML5 slides application with Node.js backend (and with social stuff and editor and Portal and extensions... https://github.com/bubersson/humla) and I want be able to log in user on some slide (via slide menu...) but then I want him to get back to same slide easily. So I would need something like

Sails socket authorization (using passport)

笑着哭i 提交于 2019-12-25 16:51:24
问题 I am using passport for authentication/authorization along with local strategy and a JWT. Following some research (intensive googling ;) I understand that the best place for the authorization is to use a policy as it applies both for a regular HTTP requests and a socket request (through SailsSocket object that can send 'virtual' HTTP-like requests). I am now trying to figure out how to use sockets properly and I've seen that there's a beforeConnect handler that allows to reject a connection.

Passport.js .authenticate() throwing TypeError: undefined is not a function

有些话、适合烂在心里 提交于 2019-12-25 16:27:51
问题 I'm new to passport (and node in general) and have been using this tutorial (http://mherman.org/blog/2015/01/31/local-authentication-with-passport-and-express-4/#.VczPbTBViko) to add passport authentication to a larger web app. I think I have been following things correctly, but when I start the app in terminal, I get the following error. passport.use(new LocalStrategy(Admin.authenticate())); ^ TypeError: undefined is not a function at Object.<anonymous> (/Users/goldru/design-data/app.js:37

How can I detect a user's computer/browser session for auth purposes

瘦欲@ 提交于 2019-12-25 09:39:40
问题 I am trying to implement a login system that sends a confirmation email to the user in case he logs in from a new computer/browser. I am using Nodejs, AngularJS and PassportJS. Any pointers to where I could find resources for this will be greatly appreciated. 回答1: The client side can detect stuff like os/browser, so you can just POST that data up to the server whenever the client loads. Other than that, you can match usernames with IP-adresses, but if you're storing that kind of information