passport.js

passport-jwt 401 Unauthorized

天大地大妈咪最大 提交于 2019-12-09 22:56:08
问题 I'm trying to implement passport-jwt authentication but I'm always getting 401 Unauthorized when trying to call the endpoint. Here is my setup passport.js var passport = require('passport'); var User = require('../models/user'); var config = require('./auth'); var JwtStrategy = require('passport-jwt').Strategy; var ExtractJwt = require('passport-jwt').ExtractJwt; var LocalStrategy = require('passport-local').Strategy; var localOptions = { usernameField: 'email' }; var localLogin = new

how to get passport.authenticate local strategy working with async/await pattern

安稳与你 提交于 2019-12-09 17:16:01
问题 I've been failing to get passport.authenticate to work at all inside of an async/await or promise pattern. Here is an example I feel should work, but it fails to execute passport.authenticate(). const passport = require("passport"); let user; try { user = await __promisifiedPassportAuthentication(); console.log("You'll never have this ", user); } catch (err) { throw err; } function __promisifiedPassportAuthentication() { return new Promise((resolve, reject) => { console.log("I run"); passport

How to use Passport-Facebook login without redirection?

房东的猫 提交于 2019-12-09 15:21:40
问题 I'm building a phonegap application which will have nodejs at the server side. I wanted to implement login using passport-facebook strategy but their callbacks specify two routes, /successcallback and /failurecallback. Having a single page application, this makes it very confusing to have users redirected to so and so page. I don't want to serve static files (index.html, login.html) from the server but rather have them on the client and ask the client to make ajax calls. So far, I'm able to

Error with passportjs: Unknown authentication strategy “local”

拟墨画扇 提交于 2019-12-09 14:58:24
问题 I am developing a nodejs application and using passportjs for authentication. I am using local strategy of passport. But when I try to login, I am getting following error: Error: Unknown authentication strategy "local" at attempt (/home/project/node_modules/passport/lib/middleware/authenticate.js:166:37) at authenticate (/home/project/node_modules/passport/lib/middleware/authenticate.js:338:7) at exports.authenticate (/home/project/controllers/RegistrationsController.js:87:4) at callbacks (

Google oauth not returning email passport authentication

℡╲_俬逩灬. 提交于 2019-12-09 14:45:54
问题 I am trying to make a sign in with google button using passport module of node js. I am trying to get person's email id, name, profile pic. I am trying to download pic to local server. Google is not returning email id even after adding 'email' to scope and nor the returned link for profile pic is working. I have looked into various answers to this question but all say to include userinfo.email. It has been deprecated now. As per google documentation new scope parameter is email. Below is my

Passport local returns error 400 bad request with Angular

对着背影说爱祢 提交于 2019-12-09 07:53:44
问题 I am trying to integrate passport to my code's login form. Client side calling server side works as it should until i call passport.authenticate in the request, 400 Bad Request was returned. What am I missing here. HTML <div> <div class="row"> <div class="input-field col s12"> <input id="user-email" type="text" ng-model="user.email"> <label for="user-email">Your email address</label> </div> </div> <div class="row"> <div class="input-field col s12"> <input id="user-password" type="password" ng

req.user undefined - node + express + passport-facebook

你离开我真会死。 提交于 2019-12-09 05:23:06
问题 i'm trying to get passport to work with my node express server. I can login in with Facebook and find the correct user in my database; however, when I redirect req.user is always undefined. Here is my server code: var express = require('express'), path = require('path'), http = require('http'), passport = require('passport'), FacebookStrategy = require('passport-facebook').Strategy, user = require('./routes/users'); var app = express(); passport.use(new FacebookStrategy({ clientID: "HIDDEN",

Ask requestVisibleActions permission using Passport.js for moment insertion in Google+ API

亡梦爱人 提交于 2019-12-09 04:27:27
I'm working on a Node.js application that uses Passport.js for authenticating with Google Plus. In a later stage now, we have introduced of adding activities using Google+'s moment.insert to the user's Google+ feed when they leave reviews at our site. Posting using moment.insert needs a special permission called requestvisibleactions . The passport.js documentation doesn't say how I can ask for such permissions while logging in. My current auth handler setup is like this: app.get('/auth/google', redirect, passport.authenticate('google', { scope: ['https://www.googleapis.com/auth/userinfo

Passport Active Directory node.js

扶醉桌前 提交于 2019-12-09 04:15:30
问题 I have successfully assembled over a half dozen passport strategies (facebook, twitter, linkedin, instagram, tumblr, google, youtube) exchange account info with oauth1 and oauth2 token, into a single standalone auth server that saves session in Mongo and creates active profiles, with token/session/code/id fields and with many standardized atribute fields in SQL server using Tedious.js. These passport tools are excellent, thank you. My last challenge for this project is not going as well,

passport.deserializeUser executing a DB (sequelize) command for each HTTP request

▼魔方 西西 提交于 2019-12-09 02:46:23
问题 I'm using sequelize as an ORM and passport.js (passport-local) for authentication. I noticed that every HTTP request is resulting in a separate database command. I started looking at the deserializeUser() function. When loading a single page, this is what I get: Executing: SELECT * FROM Users WHERE Users . id =1 LIMIT 1; Over and over and over! GET / 200 12ms - 780 Executing: SELECT * FROM Users WHERE Users . id =1 LIMIT 1; Executing: SELECT * FROM Users WHERE Users . id =1 LIMIT 1; Over and