node.js,passportRelated issues-Collection of common programming errors
???????? ????????
node.js npm vagrant provisioning
During Vagrant Shell provision I try to install NodeJS and NPM on Debian Wheezy. Script is (from guide https://github.com/joyent/node/wiki/backports.debian.org):sudo echo “deb http://ftp.us.debian.org/debian wheezy-backports main” >> /etc/apt/sources.list sudo apt-get update sudo apt-get install -y nodejs-legacy curl https://npmjs.org/install.sh | sudo shNode sets up as a charm, but NPM installation fails:Stderr from the command:stdin: is not a tty dpkg-preconfigure: unable to re-open stdi
Peter Mortensen
mysql node.js npm visual-studio-2013
When I’m trying to install the Node.JS MySQL module trough Visual Studio 2013 npm Package Management, the installation fails due to the following errors:npm ERR! Failed to parse json npm ERR! Unexpected token How do I solve this or is there another way to do this?
lowerkey
javascript node.js try-catch try-catch-finally
I read about try catch(e if e instanceof …) blocks on MDN, however, upon trying it in Node.js, I get a SyntaxError: Unexpected token if.If this doesn’t work, is there another way to catch specific exceptions, instead of everything that might occur?
gpasse
node.js meteor
I managed to deploy meteor on my infrastructure (Webfactions). The application seems to work fine but I get the following error when my application starts :WebSocket connection to ‘ws://myapp.mydomain.com/sockjs/656/ll_djq7e/websocket’ failed: Unexpected response code: 400 I am not sure what to do to solve the problem.
trusktr
node.js coffeescript
I npm installed the node-term-ui package, but I keep getting “Unexpected string” errors, then I noticed the syntax in the files looks different, and realized it’s CoffeeScript which I’ve never used before.How do I make it work?
Andres Riofrio
javascript node.js throw
Here is what I want to do:var setting = process.env.SETTING || throw new Error(“please set the SETTING environmental variable”);^^^^^But the interpreter complains about “Syntax Error: Unexpected token throw”.Is there any way to throw an exception in the same line that we compare whether a value is falsey or not?
CamelCamelCamel
ruby ruby-on-rails-3 node.js redis resque
I want to queue Resque jobs from NodeJS. Monitoring Redis commands I see:1346127083.495055 “sadd” “resque:w:tasks:queues” “facebook” 1346127083.495471 “rpush” “resque:w:tasks:queue:facebook” “{\”class\”:\”Hello::FacebookFriends\”,\”args\”:[\”2342324\”]}”Issuing those commands directly from Node seems to work. Are there any hidden bugs or things I’m not aware of here?Update: My jobs are written in Ruby. While I love NodeJS and I’m way better in Javascript, I need tons of libraries that are still
user1020015
node.js mongodb ubuntu meteor
I am using a fresh linux install. I am trying to install meteor. Using Ubuntu 12.04, Centos and Ubuntu 13.04. I installed NodeJs, Meteor and Meteorite. But I get this error:Unexpected mongo exit code 100. Restarting.Unexpected mongo exit code 100. Restarting.Unexpected mongo exit code 100. Restarting.Can’t start mongodMongoDB had an unspecified uncaught exception. This can be caused by MongoDB being unable to write to a local database. Check that you have permissions to write to .meteor/local. M
pb2q
node.js foreach associative-array jade
Ok, I am getting an associative array from node server and trying to render it in Jade. I obviously need a foreach loop, but nothing seems to work! I tried these both codes:- foreach row in rows {li= row – }and- rows.forEach(function(item)) {li= item – })the array I am passing is called “rows”. Any idea why this is not working? I am getting this error:500 SyntaxError: Unexpected identifierand, with the second code:500 SyntaxError: Unexpected token )
Sean Mickey
json node.js express
I installed node.js and express.js and I’m trying to use: var str = { test: ‘info’}; obj = JSON.parse(str);but it causes an error: SyntaxError: Unexpected token 0 at Object.parse (native)How can I fix this? Thanks.
mfreitas
node.js authentication angularjs express passport
I’m starting to experiment with expressJS + angularJS and i’ve run into a stressful situation.My goal is to have one login page and one dashboard page, and using passport + mongodb i’ll authenticate a user in and, if credentials are correct, redirect him to the dashboard page.I’ve started with the angular-express-seed and modified it so i ended up with the previously mentioned views:$routeProvider.when(‘/login’, {templateUrl: ‘partials/login’,controller: ‘LoginCtrl’}).when(‘/dashboard’, {templat
asgoth
api node.js oauth express passport
I’ve got I think a specific problem, unless I’m not doing things in the right way.I’ve got an application with 2 sides, a client (html site), and an API (built with express + mongodb). The API will need to be securely accessed. They both are on different domains, for now let’s say my site is on domain.com and my API is on api.com:3000.I’ve added passport to get an access token from Github as I’m creating my users with their data, so I can have a “Sign in with Github” basically.My current process
Carlos
node.js express passport
I have a server in node.js using express and passport with the passport-local strategy.I have the users in the database and through passport I’m able to authenticate them, unfortunately when a second request comes from the same client the req.isAuthenticated() method returns false. There is also no user in the request (req.user = undefined). I’ve also checked and when doing the authentication although I get back a user from passport.authenticate(‘local’… I do not get req.user populated then.
Mantissa
node.js passport passportjs
I’m new to node and am trying to get a simple local login up and running using passport.js. It looks to me that the strategy that I have set up is not being run when the authenticate function is called. module.exports = function(app) { var mongo = require(‘./mongoose-db.js’); var brands = require(‘./app/brands.js’);// brand admin page //var passport = require(‘passport’); var LocalStrategy = require(‘passport-local’).Strategy;passport.use(new LocalStrategy( {//this is a strategy but why is it no
milestyle
node.js oauth-2.0 passport bit.ly
I’m trying to authenticate to bitly so I can use the link-shortener and track the users’ metrics. My implementation is like this:passport.use(new BitlyStrategy({clientID: “my client id here”,clientSecret: “my secret here”,callbackURL: “http://website.com/auth/bitly/callback” }, function (token, tokenSecret, profile, done) { // Code to put it in the server here. } ));And the routes look like this:app.get(‘/auth/bitly’,passport.authenticate(‘bitly’));app.get(‘/auth/bitly/callback’, passport.authe
maddy
node.js express varnish passport
I’m a php dev, trying to understand node.js.. i can’t find the answer.. I’m making a little chat, using passport for authentication. I’ve made a facebook Strategy which works very well. I’ve made a google Strategy and i can’t figure out what’s happenning : I click on the google login, i’m redirected by google to the chat, and then i have to wait untill varnish gives me a “Error 503 Service Unavailable”.. But Node has not crashed !So varnish in front, node.js behind.. and here is my code..passp
AntelopeSalad
node.js express mongoose passport
I’ve successfully implemented passport-local into my express/mongoose web app but I’m having trouble figuring out how to render a failed login message properly.Here’s my login route:app.get(‘/login’, function(req, res) {res.render(‘user/login’, {}); });With a route like that how am I supposed to report an invalid login? If the login is successful it will write the id/username to the req.user object but that doesn’t help me in the GET /login route because if it’s successful you will get redirecte
Kundu
node.js express cors passport
I am using passport JS, express and mongoose to make an API. When I test it in same domain it maintain session and works fine. But in cross domain it fails. Any clue how can i maintain the session in cross domain using the same configuration. Following is the codeallowCrossDomain = function(req, res, next) {res.header(“Access-Control-Allow-Origin”, “*”);res.header(“Access-Control-Allow-Methods”, “GET, POST, PUT, DELETE, OPTIONS”);res.header(“Access-Control-Allow-Headers”, req.headers[“access-con
Javier Manzano
javascript node.js oauth passport compoundjs
I’m facing this problem with compound passport. I’ve already followed the steps from the guide but I cannot get this working when I try to access /auth/github.Any tips?GET /auth/github controller: auth action: github Params: {“controller”:”auth”,”action”:”github”} >>> perform github Error: Undefined action auth#github(/auth/github) at Object.FlowControl.call.context.innerNext (/Users/javiermanzanomorilla/Development/workspace/authapp/node_modules/compound/node_modules/kontroller/lib/fl
Raf
facebook node.js authentication passport passportjs
I must be overlooking something here. I’m using the Facebook strategy of passportjs to authenticate users. This is done with 2 requests/[route handlers]://one to initiate the the auth: init: function (req, res, next) {passport.authenticate(‘facebook’, {callbackURL: URL + ‘/facebook/callback’,state: req.body //attempting to put some state})(req, res, next) }//one callback callback: function (req, res, next) {passport.authenticate(‘facebook’, {callbackURL: URL + ‘/facebook/callback’},function (err
Web site is in building