passport-jwt.socketio
A Socket.IO middleware for authenticating with a JSON Web Token based on passport-jwt.
This module lets you authenticate socket.io endpoints using a JSON web token. It is intended to be used to secure endpoints without sessions.
Example usage
// Initialize our modulesconst io = serverconst passportJwtSocketIo = // set the passport-jwt optionsconst options = jwtFromRequest: ExtractJwt secretOrKey: secret // define the verify callback { // token is valid // we still can verify the token // the user passed is set to socket.request.user } // set the authorization middlewareio
Tests
npm install
npm test
Inspiration
Contribute
You are always welcome to open an issue or provide a pull-request!
License
The MIT License