passport.js

Unknown Authentication Facebook Strategy - PassportJS

烂漫一生 提交于 2019-12-11 07:32:46
问题 I've a issue with PassportJS. It displays this message and I can't understand where I'm doing wrong: {"message":"Unknown authentication strategy \"facebook\"","error":{}} GET /auth/facebook 500 0.505 ms - 69 Credentials are hardcoded for simplicity and learning purpose. Passport and Passport-Facebook are installed. auth/index.js var passport = require('passport'); var FacebookStrategy = require('passport-facebook').Strategy; var User = require('../modules/user'); module.exports = function(){

PassportJS Authentication Won't Execute on Login Attempt (browser times out)

落爺英雄遲暮 提交于 2019-12-11 07:22:42
问题 I'm very new to Passport & Node, I've been trying to solve an issue for several days without being able to find a solution that already exists on SO or the internet. I'm getting no errors or anything on login attempt, nothing in chrome dev, nothing in gitbash. Only problem is page never redirects, never seems to get through the passport.authenticate function inside my auth controller (/dologin). When I attempt a login, the browser never stops loading (ex. the circle keeps spinning for chrome)

Cannot post in an Express + Passport app / Authentication test

≡放荡痞女 提交于 2019-12-11 07:01:38
问题 I am trying to use Passport as an authentication middleware with Express - and Angular, if it matters. I have just started to know these frameworks and I experiment with a simple test login in the app. These are the relevant code snippets in my root/app.js that should do the login method: var express = require('express'), routes = require('./routes'), api = require('./routes/api'), passport = require('passport'), LocalStrategy = require('passport-local').Strategy; ... app.configure(function()

Custom Callback never called when Google Auth on passportjs

扶醉桌前 提交于 2019-12-11 06:36:57
问题 I try to login with Google by using PassportJS. But when I use the custom callback, the Google Strategy never called the callback. What am I doing wrong? My codes are below. endpoints: var router = express.Router(); router.get('/', passport.authenticate('google', { scope: [ 'https://www.googleapis.com/auth/plus.login', 'https://www.googleapis.com/auth/plus.profiles.read', 'https://www.googleapis.com/auth/userinfo.email' ] } )); router.get('/callback', function (req, res) { console.log("GOOGLE

Node + Passport - multiple users

限于喜欢 提交于 2019-12-11 05:59:10
问题 When trying to implement the example code from the passport guide, I'm running into an issue where the most recently logged in user "replaces" all others. For example: user1 logs in and leaves a note as user1 user2 logs in now when user1 leaves a note, it's posted as user2 Do the user sessions need to be stored in a database with something like connect-mongo or does passport keep track of individual sessions? It seems like the API calls are always getting the req.user for the most recent user

Configure CORS/xmlhttprequest to allow cross site access to username/password protected data

拥有回忆 提交于 2019-12-11 05:57:59
问题 I have 2 websites. I am looking to allow a webpage from one website to access data on from other website and display it. For clarity I will refer to the the website accessing the the data as the client website (myclientsite.com), and the website that contains the data as the server website (myserversite.com). The server site is username/password protected. The code on the client site is able to successfully log into the server site, but subsequent attempts to access the needed data result in

Converting a raw cookie to be accepted by puppeteer

て烟熏妆下的殇ゞ 提交于 2019-12-11 05:36:45
问题 I want to pass session from passport.js to puppeteer. I used var cookies = req.cookies; in order to get the cookies value. I console.logged it and it is something like this: { 'connect.sid': 's:qX4ZrttrjydtrjkgsdghsdghrewynZj4Ew2OUh.tTSILkcvgsegsegsegsr99gmW5 0XLcJefM' } I thought that it would be as easy as to pass this value to puppeteer. But puppeteer has a page.setCookie() function that its format is this: page.setCookie(...cookies) ...cookies <...Object> name <string> required value

Trouble authenticating with passport after refactoring code

旧城冷巷雨未停 提交于 2019-12-11 05:06:13
问题 I am building out a RESTful app using node.js, mongoose, express & passport using .ejs as a front end. I'm trying to add authentication back in with passport. With the current code I can register a new user, but that new user does not remain logged in, and after creating the user, I cannot login to do activities requiring authorization. There is no persistent user it seems. I'm using express-session as well. I've searched for similar issues but any "fixes" have not seemed to help. I have

Sails.js + Passport.js: passport.initialize() middleware not in use

痴心易碎 提交于 2019-12-11 04:07:08
问题 I am using Sails.js and trying to use Passport.js with a REST API. But I am facing the following error when I try to call my login function in my controller: /Users/Michael/Development/DictationProject/sails/20151010/dictee/node_modules/passport/lib/http/request.js:44 if (!this._passport) { throw new Error('passport.initialize() middleware not in use'); } ^ Error: passport.initialize() middleware not in use at IncomingMessage.req.login.req.logIn (/Users/Michael/Development/DictationProject

Using passport.js with multiple strategies without overwriting user request object

不打扰是莪最后的温柔 提交于 2019-12-11 03:54:04
问题 I'm using passport.js local-strategy for auth. I also need users to authenticate with Facebook, Twitter, and G+, but not as auth alternatives, but to enable the user to retrieve their content from those services. As written, each auth strategy writes a user object to the request object. This has the effect of logging-out my root user. Is there a way to leverage passport for these additional auth strategies, but not override the user object? Here is the canonical example: var passport =