passport.js

Passport authentication callback hangs

偶尔善良 提交于 2021-02-10 04:35:52
问题 After hours trying to solve this by myself I reach to SO community looking for some light. I'm using passport for user authentication. It's already initialized in my main express.js file as per the docs: app.use(passport.initialize()); I got a index.js file which handles facebook-passport in this manner: Index.js 'use strict'; import express from 'express'; import passport from 'passport'; import auth from '../auth.service'; let router = express.Router(); //this function is defined in the

bind error with ldap authentication using Passport and node.js

风格不统一 提交于 2021-02-08 10:25:58
问题 I have problem to bind to the ldap server. I have following codes: in passport.js module.exports = function() { // Serialize sessions passport.serializeUser(function(user, done) { console.log('userid' + user.id) done(null, user.id); }); // Deserialize sessions passport.deserializeUser(function(id, done) { User.findOne({ _id: id }, '-password', function(err, user) { done(err, user); }); }); passport.use(new LdapStrategy({ usernameField:'username', passwordField:'password', server: { url: 'ldap

/node_modules/http-proxy/lib/http-proxy/index.js:120; Error: socket hang up

我们两清 提交于 2021-02-08 08:55:23
问题 I'm running expressJS in one of the containers I'm trying to run in docker-compose; When I keep pressing CMD+R to refresh the landing page (Probably 3~4 seconds), it says "Error: socket hang up" and broken. Here is the error saml-enabled-reverse-proxy_1 | /node_modules/http-proxy/lib/http-proxy/index.js:120 saml-enabled-reverse-proxy_1 | throw err; saml-enabled-reverse-proxy_1 | ^ saml-enabled-reverse-proxy_1 | saml-enabled-reverse-proxy_1 | Error: socket hang up saml-enabled-reverse-proxy_1

Authenticate user with passport through LinkedIn login

你离开我真会死。 提交于 2021-02-08 03:54:24
问题 I have built a login system in Passport and works quite well. Now, I want to integrate LinkedIn login in my system. I already have clientID , clientSecret etc. needed to login. This is the code that is called when the LinkedIn login button is pressed. passport.use('linkedin', new OAuth2Strategy({ authorizationURL: 'https://www.linkedin.com/uas/oauth2/authorization', tokenURL: 'https://www.linkedin.com/uas/oauth2/accessToken', clientID: clientid, clientSecret: clientsecret, callbackURL: '

Node.js and Passport Object has no method validPassword

↘锁芯ラ 提交于 2021-02-05 20:27:34
问题 I'm using Node.js + Express + Passport to create a simple authentication(local) and what I've reached so far that when a wrong username or password entered user is redirected to an error page but when the user enters a correct username and password I get this error node_modules\mongoose\lib\utils.js:435 throw err; ^ TypeError: Object { _id: 50b347decfd61ab9e9e6768f, username: 'saleh', password: '123456' } has no method 'validPassword' I'm not sure what's wrong there app.js (I removed the

Node.js and Passport Object has no method validPassword

痞子三分冷 提交于 2021-02-05 20:25:25
问题 I'm using Node.js + Express + Passport to create a simple authentication(local) and what I've reached so far that when a wrong username or password entered user is redirected to an error page but when the user enters a correct username and password I get this error node_modules\mongoose\lib\utils.js:435 throw err; ^ TypeError: Object { _id: 50b347decfd61ab9e9e6768f, username: 'saleh', password: '123456' } has no method 'validPassword' I'm not sure what's wrong there app.js (I removed the

Verifying roles & authentication with Passport.js

和自甴很熟 提交于 2021-02-05 20:11:33
问题 So I'd like to make some routes in an API that will show different data based on the user role, defined in MongoDB. Here's a sampling of what I have right now, it works... router.get('/test', passport.authenticate('bearer', {session: false}), function (req, res) { if (req.user.role == "premium") { return res.send('you can see this content'); } else { return res.send('you can not see this content'); } }) However, the end goal is to present at least something to the user, even if they're not

node.js passport autentification with sqlite

前提是你 提交于 2021-02-05 13:57:52
问题 Its possible use node.js + passport and sqlite database with session? All example only with mongoDb. I want collect all data in sqlite. 回答1: Below is an example of using passport-local to create a SQLite backed login strategy. Express specific initialization has been omitted. This example assumes you have a database with the following users table: CREATE TABLE "users" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT, "username" TEXT, "password" TEXT, -- sha256 hash of the plain-text password "salt"

node.js passport autentification with sqlite

允我心安 提交于 2021-02-05 13:57:04
问题 Its possible use node.js + passport and sqlite database with session? All example only with mongoDb. I want collect all data in sqlite. 回答1: Below is an example of using passport-local to create a SQLite backed login strategy. Express specific initialization has been omitted. This example assumes you have a database with the following users table: CREATE TABLE "users" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT, "username" TEXT, "password" TEXT, -- sha256 hash of the plain-text password "salt"

node.js passport autentification with sqlite

心不动则不痛 提交于 2021-02-05 13:56:55
问题 Its possible use node.js + passport and sqlite database with session? All example only with mongoDb. I want collect all data in sqlite. 回答1: Below is an example of using passport-local to create a SQLite backed login strategy. Express specific initialization has been omitted. This example assumes you have a database with the following users table: CREATE TABLE "users" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT, "username" TEXT, "password" TEXT, -- sha256 hash of the plain-text password "salt"