passport.socket.io

passport.socket.io allows your socket.io connections to have access to your passportjs login session.

npm install passport.socket.io
8 downloads in the last week
16 downloads in the last month

passport.socket.io

passport.socket.io allows your socket.io connections to have access to your passportjs login session.

It will populate the socket.handshake.session.passport.user variable.

usage

    // setup express
    var express = require('express')
    var RedisStore = require('connect-redis')(express);
    var redisStore = new RedisStore(); // setup redis
    var cookieParser = express.cookieParser('supersecret');

    app.configure(function(){
        app.use(cookieParser);
        app.use(express.session({store: redisStore}));
    });

    // default socket.io config
    var auth = require('passport.socket.io')(cookieParser, redisStore);
    io.set('authorization', auth);
npm loves you