From cac4cb06c86e41821f58e1d31ad0887743409f93 Mon Sep 17 00:00:00 2001 From: Philippe Date: Wed, 4 Jan 2017 11:09:02 +0100 Subject: [PATCH 01/30] fix spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d9b9bc1..cbfb4b1 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ var SECRETS = { io.use(socketioJwt.authorize({ secret: function(request, decodedToken, callback) { - // SECRETS[decodedToken.userId] will be used a a secret or + // SECRETS[decodedToken.userId] will be used as a secret or // public key for connection user. callback(null, SECRETS[decodedToken.userId]); From d2cc8fb51406af646b03ce6e62613b200b885178 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Tue, 18 Apr 2017 23:26:47 +0200 Subject: [PATCH 02/30] Renamed "data" to "socket", updated deps --- lib/index.js | 24 ++++++++++++------------ package.json | 21 ++++++++++----------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/index.js b/lib/index.js index bfcb715..4aa18ad 100644 --- a/lib/index.js +++ b/lib/index.js @@ -112,15 +112,15 @@ function authorize(options, onConnection) { } var defaults = { - success: function(data, accept){ - if (data.request) { + success: function(socket, accept){ + if (socket.request) { accept(); } else { accept(null, true); } }, - fail: function(error, data, accept){ - if (data.request) { + fail: function(error, socket, accept){ + if (socket.request) { accept(error); } else { accept(null, false); @@ -130,9 +130,9 @@ function authorize(options, onConnection) { var auth = xtend(defaults, options); - return function(data, accept){ + return function(socket, accept){ var token, error; - var req = data.request || data; + var req = socket.request || socket; var authorization_header = (req.headers || {}).authorization; if (authorization_header) { @@ -148,7 +148,7 @@ function authorize(options, onConnection) { error = new UnauthorizedError('credentials_bad_format', { message: 'Format is Authorization: Bearer [token]' }); - return auth.fail(error, data, accept); + return auth.fail(error, socket, accept); } } @@ -164,25 +164,25 @@ function authorize(options, onConnection) { error = new UnauthorizedError('credentials_required', { message: 'No Authorization header was found' }); - return auth.fail(error, data, accept); + return auth.fail(error, socket, accept); } var onJwtVerificationReady = function(err, decoded) { if (err) { error = new UnauthorizedError(err.code || 'invalid_token', err); - return auth.fail(error, data, accept); + return auth.fail(error, socket, accept); } - data[options.decodedPropertyName] = decoded; + socket[options.decodedPropertyName] = decoded; - return auth.success(data, accept); + return auth.success(socket, accept); }; var onSecretReady = function(err, secret) { if (err) { error = new UnauthorizedError(err.code || 'invalid_secret', err); - return auth.fail(error, data, accept); + return auth.fail(error, socket, accept); } jwt.verify(token, secret, options, onJwtVerificationReady); diff --git a/package.json b/package.json index ba5258a..bd0589a 100644 --- a/package.json +++ b/package.json @@ -22,19 +22,18 @@ }, "license": "MIT", "dependencies": { - "jsonwebtoken": "^5.0.0", - "xtend": "~2.1.2" + "jsonwebtoken": "^7.3.0", + "xtend": "~4.0.1" }, "devDependencies": { - "body-parser": "~1.13.3", - "express": "~4.10.6", - "mocha": "~1.17.0", - "passport-local": "~0.1.6", - "request": "~2.19.0", - "serve-static": "^1.7.1", + "body-parser": "~1.17.1", + "express": "~4.15.2", + "mocha": "~3.2.0", + "request": "~2.81.0", + "serve-static": "^1.12.1", "server-destroy": "~1.0.1", - "should": "~1.2.2", - "socket.io": "^1.0.4", - "socket.io-client": "^1.0.4" + "should": "~11.2.1", + "socket.io": "^1.7.3", + "socket.io-client": "^1.7.3" } } From d340c81fd5c44502c4146ea172f8411d65682db2 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Tue, 18 Apr 2017 23:31:38 +0200 Subject: [PATCH 03/30] Added option to store encoded jwt, default "encoded_token" --- lib/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index bfcb715..54b33b7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -61,6 +61,9 @@ function noQsMethod(options) { return onError({message: 'invalid token datatype'}, 'invalid_token'); } + // Store encoded JWT + socket[options.encodedPropertyName] = token; + var onJwtVerificationReady = function(err, decoded) { if (err) { @@ -105,7 +108,7 @@ function noQsMethod(options) { } function authorize(options, onConnection) { - options = xtend({ decodedPropertyName: 'decoded_token' }, options); + options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options); if (!options.handshake) { return noQsMethod(options); @@ -167,6 +170,9 @@ function authorize(options, onConnection) { return auth.fail(error, data, accept); } + // Store encoded JWT + socket[options.encodedPropertyName] = token; + var onJwtVerificationReady = function(err, decoded) { if (err) { From 025952dcc7fbe552d20f0b40f709ba38e1464736 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Tue, 18 Apr 2017 23:56:22 +0200 Subject: [PATCH 04/30] Fixed dirty cherry-pick --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 54b33b7..1971132 100644 --- a/lib/index.js +++ b/lib/index.js @@ -171,7 +171,7 @@ function authorize(options, onConnection) { } // Store encoded JWT - socket[options.encodedPropertyName] = token; + data[options.encodedPropertyName] = token; var onJwtVerificationReady = function(err, decoded) { From cc3d6b22b730b6214ef9fefc6b59e85a111aa738 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Wed, 19 Apr 2017 00:01:18 +0200 Subject: [PATCH 05/30] Fixed dirty copy and paste mistake.. --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 1971132..6d96683 100644 --- a/lib/index.js +++ b/lib/index.js @@ -62,7 +62,7 @@ function noQsMethod(options) { } // Store encoded JWT - socket[options.encodedPropertyName] = token; + socket[options.encodedPropertyName] = data.token; var onJwtVerificationReady = function(err, decoded) { From 40334831548dd376071269ea051461088a55cdc0 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Wed, 19 Apr 2017 00:23:05 +0200 Subject: [PATCH 06/30] Fixed mocha tests by downgrading "jsonwebtoken" Version 5.7.0 is the last working. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bd0589a..6aedca6 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "dependencies": { - "jsonwebtoken": "^7.3.0", + "jsonwebtoken": "^5.7.0", "xtend": "~4.0.1" }, "devDependencies": { From 250312152a85282edd9064b468a94d62853cffc4 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Wed, 19 Apr 2017 00:33:26 +0200 Subject: [PATCH 07/30] Fixed mocha tests by not using `expiresInMinutes` Using `expiresInMinutes` leads to errors, as it was deprecated in `jsonwebtoken` > 5.7.0. We should use `expiresIn` instead. --- package.json | 2 +- test/fixture/index.js | 2 +- test/fixture/namespace.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6aedca6..bd0589a 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "dependencies": { - "jsonwebtoken": "^5.7.0", + "jsonwebtoken": "^7.3.0", "xtend": "~4.0.1" }, "devDependencies": { diff --git a/test/fixture/index.js b/test/fixture/index.js index 432c474..f897021 100644 --- a/test/fixture/index.js +++ b/test/fixture/index.js @@ -38,7 +38,7 @@ exports.start = function (options, callback) { }; // We are sending the profile inside the token - var token = jwt.sign(profile, options.secret, { expiresInMinutes: 60*5 }); + var token = jwt.sign(profile, options.secret, { expiresIn: 60*60*5 }); res.json({token: token}); }); diff --git a/test/fixture/namespace.js b/test/fixture/namespace.js index d3de1f5..eff8223 100644 --- a/test/fixture/namespace.js +++ b/test/fixture/namespace.js @@ -38,7 +38,7 @@ exports.start = function (callback) { }; // We are sending the profile inside the token - var token = jwt.sign(profile, options.secret, { expiresInMinutes: 60*5 }); + var token = jwt.sign(profile, options.secret, { expiresIn: 60*60*5 }); res.json({token: token}); }); From 9b644e22cedd7929a3717e181a2a3f0c1871710f Mon Sep 17 00:00:00 2001 From: Ryan Chenkie Date: Tue, 9 May 2017 11:34:43 -0400 Subject: [PATCH 08/30] deprecate sample --- example/README.md | 3 + example/socketsio-auth0-sample/README.md | 30 ------- example/socketsio-auth0-sample/index.js | 41 ---------- example/socketsio-auth0-sample/package.json | 28 ------- .../public/stylesheets/style.css | 10 --- .../socketsio-auth0-sample/views/index.pug | 78 ------------------- .../socketsio-auth0-sample/views/layout.pug | 7 -- 7 files changed, 3 insertions(+), 194 deletions(-) create mode 100644 example/README.md delete mode 100644 example/socketsio-auth0-sample/README.md delete mode 100644 example/socketsio-auth0-sample/index.js delete mode 100644 example/socketsio-auth0-sample/package.json delete mode 100644 example/socketsio-auth0-sample/public/stylesheets/style.css delete mode 100644 example/socketsio-auth0-sample/views/index.pug delete mode 100644 example/socketsio-auth0-sample/views/layout.pug diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..9157c92 --- /dev/null +++ b/example/README.md @@ -0,0 +1,3 @@ +# Deprecation Notice + +This sample has been deprecated. Please see the [auth0-samples](https://github.com/auth0-samples) org for the latest Auth0 samples. \ No newline at end of file diff --git a/example/socketsio-auth0-sample/README.md b/example/socketsio-auth0-sample/README.md deleted file mode 100644 index ccc146e..0000000 --- a/example/socketsio-auth0-sample/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Auth0 + Socket.io - -This is the seed project you need to use if you're going to create a Socket.io single page app that will use Auth0. - -### Configure your Auth0 credentials - -First, you need to set the ClientSecret, ClientId and Domain for your Auth0 app as environment variables with the following names respectively: `AUTH0_CLIENT_SECRET`, `AUTH0_CLIENT_ID` and `AUTH0_DOMAIN`. You can find this information in your Auth0 Dashboard. - -So, create a file named `.env` in the directory and set the values like the following: - -````bash -# .env file -AUTH0_CLIENT_SECRET=myCoolSecret -AUTH0_CLIENT_ID=myCoolClientId -AUTH0_DOMAIN=myCoolDomain -```` - -### Set up the Allowed Origin (CORS) in Auth0 - -Then, you need to put `http://localhost:3001` as an Allowed Origin (CORS) in the Application Settings on your Auth0.com dashboard. - -### Running the example - -In order to run the example, you need to have `node` installed. - -1. run `npm install` -1. run `node index.js` in the directory of this project. - - -Go to [http://localhost:3001](http://localhost:3001) and you'll see the app running :). diff --git a/example/socketsio-auth0-sample/index.js b/example/socketsio-auth0-sample/index.js deleted file mode 100644 index aba5f43..0000000 --- a/example/socketsio-auth0-sample/index.js +++ /dev/null @@ -1,41 +0,0 @@ -var express = require('express'); -var app = express(); -var http = require('http').Server(app); -var io = require('socket.io')(http); -var socketioJwt = require('socketio-jwt'); -var dotenv = require('dotenv'); - -dotenv.load(); - -var env = { - AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID, - AUTH0_DOMAIN: process.env.AUTH0_DOMAIN -}; -var port = process.env.PORT || 3001; - -app.set('views', __dirname + '/views'); -app.set('view engine', 'pug'); - -io - .on('connection', socketioJwt.authorize({ - secret: Buffer(JSON.stringify(process.env.AUTH0_CLIENT_SECRET), 'base64'), - timeout: 15000 // 15 seconds to send the authentication message - })) - .on('authenticated', function(socket){ - console.log('connected & authenticated: ' + JSON.stringify(socket.decoded_token)); - socket.on('chat message', function(msg){ - debugger; - io.emit('chat message', msg); - }); - }); - -app.use(express.static(__dirname + '/public')); - -app.get('/', function (req, res) { - res.render('index', { env: env }); -}); - -http.listen(port, function(){ - console.log('listening on *:' + port); -}); - diff --git a/example/socketsio-auth0-sample/package.json b/example/socketsio-auth0-sample/package.json deleted file mode 100644 index 79381ce..0000000 --- a/example/socketsio-auth0-sample/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "socket-auth0-chat-example", - "version": "1.0.0", - "description": "Auth0 + Socket.io seed", - "repository": { - "type": "git", - "url": "git://github.com/auth0/socketio-jwt.git" - }, - "author": "Auth0", - "license": "MIT", - "dependencies": { - "dotenv": "^2.0.0", - "express": "^4.13.4", - "pug": "^2.0.0-beta2", - "socket.io": "^1.4.6", - "socketio-jwt": "^4.3.4" - }, - "bugs": { - "url": "https://github.com/auth0/socketio-jwt/issues" - }, - "homepage": "https://github.com/auth0/socketio-jwt#readme", - "devDependencies": {}, - "scripts": { - "start": "node index.js", - "test": "echo \"Error: no test specified\" && exit 1" - } - -} diff --git a/example/socketsio-auth0-sample/public/stylesheets/style.css b/example/socketsio-auth0-sample/public/stylesheets/style.css deleted file mode 100644 index 2e749fe..0000000 --- a/example/socketsio-auth0-sample/public/stylesheets/style.css +++ /dev/null @@ -1,10 +0,0 @@ -* { margin: 0; padding: 0; box-sizing: border-box; } -body { font: 13px Helvetica, Arial; } -#chatForm { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; } -#chatForm input { border: 0; padding: 10px; width: 90%; margin-right: .5%; } -#chatForm button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; } -#messages { list-style-type: none; margin: 0; padding: 0; } -#messages li { padding: 5px 10px; } -#messages li:nth-child(odd) { background: #eee; } -#login { width: 100%; padding: 10px } -#login button { width: 10%; padding: 8px; border: none; background: rgb(130, 255, 130);} diff --git a/example/socketsio-auth0-sample/views/index.pug b/example/socketsio-auth0-sample/views/index.pug deleted file mode 100644 index 3175adc..0000000 --- a/example/socketsio-auth0-sample/views/index.pug +++ /dev/null @@ -1,78 +0,0 @@ -extends layout - -block content - script(src="https://cdn.auth0.com/js/lock/10.0/lock.min.js") - script(src="/socket.io/socket.io.js") - script(src="http://code.jquery.com/jquery-1.12.4.js") - - - div#login - button.btn Login - div#chat - ul#messages - form(id="chatForm" action="") - input(id="m" autocomplete="off") - button.btn Send - - script. - var userProfile; - var userToken; - var lock = new Auth0Lock('#{env.AUTH0_CLIENT_ID}', '#{env.AUTH0_DOMAIN}'); - var id_token = localStorage.getItem('id_token'); - $('#chat').hide(); - $('#login button').click(function (e) { - e.preventDefault(); - lock.show(); - }); - - lock.on('authenticated', function(authResult) { - lock.getProfile(authResult.idToken, function(error, profile) { - if (error) { - // Handle error - return; - } - console.log('connected and authenticated'); - localStorage.setItem('id_token', authResult.idToken); - localStorage.setItem('profile', JSON.stringify(profile)); - userProfile = profile; - id_token = authResult.idToken; - openChat(); - }); - }); - - if (id_token) { - lock.getProfile(id_token, function (err, profile) { - if (err) { - return alert('There was an error getting the profile: ' + err.message); - } - userProfile = profile; - openChat(); - }); - } - - function openChat() { - var socket = io(); - socket - .on('connect', function (msg) { - console.log("connected"); - socket.emit('authenticate', {token: id_token}); // send the jwt - }) - .on('authenticated', function () { - //Do - $('#login').hide(); - $('#chat').show(); - $('form').submit(function (event) { - socket.emit('chat message', $('#m').val()); - $('#m').val(''); - return false; - }); - }) - .on('unauthorized', function(msg){ - console.log("unauthorized: " + JSON.stringify(msg.data)); - throw new Error(msg.data.type); - }) - .on('chat message', function (msg) { - console.log("msg"); - $('#messages').append($('
  • ').text(msg)); - }); - }; diff --git a/example/socketsio-auth0-sample/views/layout.pug b/example/socketsio-auth0-sample/views/layout.pug deleted file mode 100644 index 5941a37..0000000 --- a/example/socketsio-auth0-sample/views/layout.pug +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - - link(rel='stylesheet', href='/stylesheets/style.css') - body - block content From b504cee60c85d4043d1ca39eda927f6e041cf53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Aguiar?= Date: Thu, 31 Aug 2017 14:54:21 -0300 Subject: [PATCH 09/30] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d9b9bc1..33f0019 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# DEPRECATED - This library is no longer maintained/supported. + [![Build Status](https://travis-ci.org/auth0/socketio-jwt.svg)](https://travis-ci.org/auth0/socketio-jwt) Authenticate socket.io incoming connections with JWTs. This is useful if you are build a single page application and you are not using cookies as explained in this blog post: [Cookies vs Tokens. Getting auth right with Angular.JS](http://blog.auth0.com/2014/01/07/angularjs-authentication-with-cookies-vs-token/). From c0e66b62d733b6373dc1c79f351bdfb19fdeff3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Aguiar?= Date: Thu, 31 Aug 2017 15:53:25 -0300 Subject: [PATCH 10/30] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33f0019..69346d9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DEPRECATED - This library is no longer maintained/supported. +# This library is no longer maintained/supported by Auth0 [![Build Status](https://travis-ci.org/auth0/socketio-jwt.svg)](https://travis-ci.org/auth0/socketio-jwt) From eba9925f2abcf2803e2feae1ab16e5c634f04c43 Mon Sep 17 00:00:00 2001 From: kaisle Date: Thu, 27 Sep 2018 10:53:48 +0200 Subject: [PATCH 11/30] Add cookie support --- lib/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index bfcb715..9519a95 100644 --- a/lib/index.js +++ b/lib/index.js @@ -35,7 +35,7 @@ function noQsMethod(options) { message: (Object.prototype.toString.call(err) === '[object Object]' && err.message) ? err.message : err }); var callback_timeout; - // If callback explicitely set to false, start timeout to disconnect socket + // If callback explicitely set to false, start timeout to disconnect socket if (options.callback === false || typeof options.callback === "number") { if (typeof options.callback === "number") { if (options.callback < 0) { @@ -57,7 +57,9 @@ function noQsMethod(options) { } }; - if(!data || typeof data.token !== "string") { + var token = options.cookie ? socket.request.cookies[options.cookie] : (data ? data.token : undefined); + + if(!token || typeof token !== "string") { return onError({message: 'invalid token datatype'}, 'invalid_token'); } @@ -96,10 +98,10 @@ function noQsMethod(options) { return onError(err, 'invalid_secret'); } - jwt.verify(data.token, secret, options, onJwtVerificationReady); + jwt.verify(token, secret, options, onJwtVerificationReady); }; - getSecret(socket.request, options.secret, data.token, onSecretReady); + getSecret(socket.request, options.secret, token, onSecretReady); }); }; } From 47529f4f1499e6f89e9c61504ed0b52da054a941 Mon Sep 17 00:00:00 2001 From: Zadkiel Date: Tue, 2 Oct 2018 19:52:16 +0200 Subject: [PATCH 12/30] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba5258a..8c6f4f8 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "license": "MIT", "dependencies": { - "jsonwebtoken": "^5.0.0", + "jsonwebtoken": "^8.3.0", "xtend": "~2.1.2" }, "devDependencies": { From 392c316f0e083bfa3870766e86c2fa504b6327e6 Mon Sep 17 00:00:00 2001 From: Conrad Sopala Date: Wed, 2 Jan 2019 13:50:27 +0100 Subject: [PATCH 13/30] Added issue template. --- ISSUE_TEMPLATE.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ISSUE_TEMPLATE.md diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..22810c1 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,36 @@ +# Issue Report + +If you are reporting a bug, please fill the sections below (if they are applicable), otherwise feel free to delete those that don't apply. Thank you! πŸ™πŸΌ + +### Description + +What are you reporting? + +### Expected behaviour + +Tell us what you think should happen. + +### Actual behaviour + +Tell us what actually happens. + +### Steps to reproduce the problem + +Tell us what we should do to reproduce the issue. + +### Language / Framework Versions + +1. **Language used:** +2. **Framework used:** + +### Testing environment + +1. **Operating system:** +2. **Browser version:** + +### Screenshots + +Feel free to insert here any screenshots that you consider helpful in solving your issue. + + +**Filling this, you're helping yourself and repo maintainers in solving your issues quicker! Teamwork makes the dreamwork πŸ€œπŸΌπŸ€›πŸ»** From 4bd9ba60e5c8c19a63bdfb6a1bd3525079a50b1f Mon Sep 17 00:00:00 2001 From: Conrad Sopala Date: Wed, 2 Jan 2019 19:52:26 +0100 Subject: [PATCH 14/30] Create PULL_REQUEST_TEMPLATE.md --- PULL_REQUEST_TEMPLATE.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 PULL_REQUEST_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..fa3bf58 --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,32 @@ +# Pull Request Report + +Please include a summary of the change you made with relevant motivation and context why such change has been made. Filling sections below will allow us to get your changes reviewed and merged easier. If you feel like certain section is not applicable, feel free to delete it. Thanks for co-operation! πŸ™πŸΌ + +### Description + +Tell us what you changed, why you did it and what additional value it will bring. + +### Type of change + +- [ ] Bug fix (fix to an issue) +- [ ] New feature (changes to functionality) +- [ ] Big change (fix or feature that would cause existing functionality to work as expected) + +### Testing + +Please describe the tests that you ran to verify your changes. Provide any instructions that will allow us to reproduce it. Please also list any relevant details for your test configuration. + +**Test Configuration** + +* Framework version: +* Language version: +* Browser version: + +### Additional info + +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings and errors +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes From 062f5880f24f799819382c27995a3539552380c1 Mon Sep 17 00:00:00 2001 From: Konrad Sopala Date: Tue, 15 Jan 2019 17:43:44 +0100 Subject: [PATCH 15/30] Unified README structure. --- README.md | 117 +++++++++++++++++--------- assets/join_auth0_community_badge.png | Bin 0 -> 10804 bytes 2 files changed, 78 insertions(+), 39 deletions(-) create mode 100644 assets/join_auth0_community_badge.png diff --git a/README.md b/README.md index b52b04e..6f087c3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,21 @@ -# This library is no longer maintained/supported by Auth0 - -[![Build Status](https://travis-ci.org/auth0/socketio-jwt.svg)](https://travis-ci.org/auth0/socketio-jwt) +# socketio-jwt +
    Authenticate socket.io incoming connections with JWTs. This is useful if you are build a single page application and you are not using cookies as explained in this blog post: [Cookies vs Tokens. Getting auth right with Angular.JS](http://blog.auth0.com/2014/01/07/angularjs-authentication-with-cookies-vs-token/). -## Installation +This repo is supported and maintained by Community Developers, not Auth0. For more information about different support levels check https://auth0.com/docs/support/matrix . + +## Getting started + +Chrome extensions are packaged as `.crx` files for distribution but may be loaded "unpacked" for development. For more information on how to load an unpacked extension, see the [Chrome extension docs](https://developer.chrome.com/extensions/getstarted#unpacked). + +### Installation ``` npm install socketio-jwt ``` -## Example usage +## Usage ```javascript // set authorization for socket.io @@ -26,7 +31,7 @@ io.sockets **Note:** If you are using a base64-encoded secret (e.g. your Auth0 secret key), you need to convert it to a Buffer: `Buffer('your secret key', 'base64')` -__Client side__: +**Client side** ```javascript var socket = io.connect('http://localhost:9000'); @@ -43,9 +48,9 @@ socket.on('connect', function () { }); ``` -## One roundtrip +### One roundtrip -The previous approach uses a second roundtrip to send the jwt, there is a way you can authenticate on the handshake by sending the JWT as a query string, the caveat is that intermediary HTTP servers can log the url. +The previous approach uses a second roundtrip to send the jwt. There is a way you can authenticate on the handshake by sending the JWT as a query string, the caveat is that intermediary HTTP servers can log the url. ```javascript var io = require("socket.io")(server); @@ -56,14 +61,12 @@ io.set('authorization', socketioJwt.authorize({ secret: 'your secret or public key', handshake: true })); -////////////////////////////// //// With socket.io >= 1.0 //// io.use(socketioJwt.authorize({ secret: 'your secret or public key', handshake: true })); -/////////////////////////////// io.on('connection', function (socket) { // in socket.io < 1.0 @@ -76,7 +79,7 @@ io.on('connection', function (socket) { For more validation options see [auth0/jsonwebtoken](https://github.com/auth0/node-jsonwebtoken). -__Client side__: +**Client side** Append the jwt token using query string: @@ -86,9 +89,9 @@ var socket = io.connect('http://localhost:9000', { }); ``` -## Handling token expiration +### Handling token expiration -__Server side__: +**Server side** When you sign the token with an expiration time: @@ -96,9 +99,9 @@ When you sign the token with an expiration time: var token = jwt.sign(user_profile, jwt_secret, {expiresInMinutes: 60}); ``` -Your client-side code should handle it as below. +Your client-side code should handle it as below: -__Client side__: +**Client side** ```javascript socket.on("unauthorized", function(error) { @@ -109,15 +112,15 @@ socket.on("unauthorized", function(error) { }); ``` -## Handling invalid token +### Handling invalid token Token sent by client is invalid. -__Server side__: +**Server side**: No further configuration needed. -__Client side__: +**Client side** Add a callback client-side to execute socket disconnect server-side. @@ -131,7 +134,7 @@ socket.on("unauthorized", function(error, callback) { }); ``` -__Server side__: +**Server side** To disconnect socket server-side without client-side callback: @@ -139,15 +142,15 @@ To disconnect socket server-side without client-side callback: io.sockets.on('connection', socketioJwt.authorize({ secret: 'secret goes here', // No client-side callback, terminate connection server-side - callback: false + callback: false })) ``` -__Client side__: +**Client side** Nothing needs to be changed client-side if callback is false. -__Server side__: +**Server side** To disconnect socket server-side while giving client-side 15 seconds to execute callback: @@ -155,13 +158,13 @@ To disconnect socket server-side while giving client-side 15 seconds to execute io.sockets.on('connection', socketioJwt.authorize({ secret: 'secret goes here', // Delay server-side socket disconnect to wait for client-side callback - callback: 15000 + callback: 15000 })) ``` -Your client-side code should handle it as below. +Your client-side code should handle it as below: -__Client side__: +**Client side** ```javascript socket.on("unauthorized", function(error, callback) { @@ -173,13 +176,14 @@ socket.on("unauthorized", function(error, callback) { }); ``` -## Getting the secret dynamically -You can pass a function instead of an string when configuring secret. +### Getting the secret dynamically + +You can pass a function instead of a string when configuring secret. This function receives the request, the decoded token and a callback. This way, you are allowed to use a different secret based on the request and / or the provided token. -__Server side__: +**Server side** ```javascript var SECRETS = { @@ -196,26 +200,61 @@ io.use(socketioJwt.authorize({ }, handshake: false })); - ``` ## Contribute -You are always welcome to open an issue or provide a pull-request! +Feel like contributing to this repo? We're glad to hear that! Before you start contributing please visit our [Contributing Guideline](https://github.com/auth0-community/getting-started/blob/master/CONTRIBUTION.md). -Also check out the unit tests: -```bash -npm test -``` +Here you can also find the [PR template](https://github.com/auth0-community/socketio-jwt/blob/master/PULL_REQUEST_TEMPLATE.md) to fill once creating a PR. It will automatically appear once you open a pull request. -## Issue Reporting +## Issues Reporting -If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues. +Spotted a bug or any other kind of issue? We're just humans and we're always waiting for constructive feedback! Check our section on how to [report issues](https://github.com/auth0-community/getting-started/blob/master/CONTRIBUTION.md#issues)! -## Author +Here you can also find the [Issue template](https://github.com/auth0-community/socketio-jwt/blob/master/ISSUE_TEMPLATE.md) to fill once opening a new issue. It will automatically appear once you create an issue. -[Auth0](auth0.com) +## Repo Community + +Feel like PRs and issues are not enough? Want to dive into further discussion about the tool? We created topics for each Auth0 Community repo so that you can join discussion on stack available on our repos. Here it is for this one: [socketio-jwt](https://community.auth0.com/t/auth0-community-oss-socketio-jwt/20024) + + + + ## License -This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info. +This project is licensed under the MIT license. See the [LICENSE](https://github.com/auth0-community/socketio-jwt/blob/master/LICENSE) file for more info. + +## What is Auth0? + +Auth0 helps you to: + +* Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like + * Google + * Facebook + * Microsoft + * Linkedin + * GitHub + * Twitter + * Box + * Salesforce + * etc. + + **or** enterprise identity systems like: + * Windows Azure AD + * Google Apps + * Active Directory + * ADFS + * Any SAML Identity Provider + +* Add authentication through more traditional [username/password databases](https://docs.auth0.com/mysql-connection-tutorial) +* Add support for [linking different user accounts](https://docs.auth0.com/link-accounts) with the same user +* Support for generating signed [JSON Web Tokens](https://docs.auth0.com/jwt) to call your APIs and create user identity flow securely +* Analytics of how, when and where users are logging in +* Pull data from other sources and add it to user profile, through [JavaScript rules](https://docs.auth0.com/rules) + +## Create a free Auth0 account + +* Go to [Auth0 website](https://auth0.com/signup) +* Hit the **SIGN UP** button in the upper-right corner diff --git a/assets/join_auth0_community_badge.png b/assets/join_auth0_community_badge.png new file mode 100644 index 0000000000000000000000000000000000000000..72c7058e6957a45db6d31b4562b88e2d40dbbaf5 GIT binary patch literal 10804 zcmY*<1y~%-vNrAncXtS`!67)o0t8rO(cmmB?(V_eHCTeXySqzp3GVK2_dDnO=f8KJ zXJ>nQYO1<=s!QJK@UP0U=qSV}P*70l@^VsYP*Bj2Ce%kH1jt#BD>wl12kodPD*;t8 zL3#+eKnBZcJ3>LB;{5Z2hDy&Qgb-+3egilGloSO`>_BWr-|dV|+1x;22sIRxu$v&H z2{LsuqI3h<*g6WjiBSKGLJ-par<@Rj5o+px1pW8;_c)y_&Hle6TgU&X1yPXw zpF8ZFY#i+W4`#-|}*I@pw>A!j*s*0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zth?#U+4;#(8#=Ryq0pC zB5S2at9*p0!+J5gSfeXP;2^g~!Z6@}00O@N Date: Tue, 23 Apr 2019 15:26:21 +0200 Subject: [PATCH 16/30] Request library updated. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c6f4f8..c1b510d 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "express": "~4.10.6", "mocha": "~1.17.0", "passport-local": "~0.1.6", - "request": "~2.19.0", + "request": ">=2.68.0", "serve-static": "^1.7.1", "server-destroy": "~1.0.1", "should": "~1.2.2", From 934a83666c11ea069925b155ad2c228eb24c998b Mon Sep 17 00:00:00 2001 From: Conrad Sopala Date: Tue, 23 Apr 2019 18:47:19 +0200 Subject: [PATCH 17/30] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c1b510d..0b8b8f6 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "express": "~4.10.6", "mocha": "~1.17.0", "passport-local": "~0.1.6", - "request": ">=2.68.0", + "request": "2.68.0", "serve-static": "^1.7.1", "server-destroy": "~1.0.1", "should": "~1.2.2", From c1db159ed6511c5daa7650aa3bb880dd6ae527f2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:32:17 +0000 Subject: [PATCH 18/30] docs: update README.md --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 6f087c3..318a86d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # socketio-jwt +[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
    Authenticate socket.io incoming connections with JWTs. This is useful if you are build a single page application and you are not using cookies as explained in this blog post: [Cookies vs Tokens. Getting auth right with Angular.JS](http://blog.auth0.com/2014/01/07/angularjs-authentication-with-cookies-vs-token/). @@ -258,3 +259,19 @@ Auth0 helps you to: * Go to [Auth0 website](https://auth0.com/signup) * Hit the **SIGN UP** button in the upper-right corner + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + +
    Conrad Sopala
    Conrad Sopala

    πŸ‘€ 🚧
    + + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file From 473313d348bed333f47be444de6133295c0786e3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:32:18 +0000 Subject: [PATCH 19/30] docs: create .all-contributorsrc --- .all-contributorsrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .all-contributorsrc diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000..26379e1 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,24 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + { + "login": "beardaway", + "name": "Conrad Sopala", + "avatar_url": "https://avatars3.githubusercontent.com/u/11062800?v=4", + "profile": "https://twitter.com/beardaway", + "contributions": [ + "review", + "maintenance" + ] + } + ], + "contributorsPerLine": 7, + "projectName": "auth0-socketio-jwt", + "projectOwner": "auth0-community", + "repoType": "github", + "repoHost": "https://github.com" +} From 5f784a3c591abad314bb1667cf2b0636f1ea4847 Mon Sep 17 00:00:00 2001 From: Conrad Sopala Date: Tue, 16 Jul 2019 11:33:44 +0200 Subject: [PATCH 20/30] Update README.md --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 318a86d..9b818bd 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
    +### Contributors + +Thanks goes to these wonderful people who contribute(d) or maintain(ed) this repo ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + +
    Conrad Sopala
    Conrad Sopala

    πŸ‘€ 🚧
    + + + +## Intro + Authenticate socket.io incoming connections with JWTs. This is useful if you are build a single page application and you are not using cookies as explained in this blog post: [Cookies vs Tokens. Getting auth right with Angular.JS](http://blog.auth0.com/2014/01/07/angularjs-authentication-with-cookies-vs-token/). This repo is supported and maintained by Community Developers, not Auth0. For more information about different support levels check https://auth0.com/docs/support/matrix . @@ -259,19 +275,3 @@ Auth0 helps you to: * Go to [Auth0 website](https://auth0.com/signup) * Hit the **SIGN UP** button in the upper-right corner - -## Contributors ✨ - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - -
    Conrad Sopala
    Conrad Sopala

    πŸ‘€ 🚧
    - - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file From cae64d6abab2fe76ff292631f360c064cb1de88f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:34:11 +0000 Subject: [PATCH 21/30] docs: update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b818bd..b81ea2d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # socketio-jwt -[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)
    ### Contributors @@ -11,6 +11,7 @@ Thanks goes to these wonderful people who contribute(d) or maintain(ed) this rep +
    Conrad Sopala
    Conrad Sopala

    πŸ‘€ 🚧
    Annyv2
    Annyv2

    πŸ’»
    From 4cfde424d6ea2cb91d6f71b1674abc3e3059e268 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:34:12 +0000 Subject: [PATCH 22/30] docs: update .all-contributorsrc --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 26379e1..452acc8 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -14,6 +14,15 @@ "review", "maintenance" ] + }, + { + "login": "Annyv2", + "name": "Annyv2", + "avatar_url": "https://avatars3.githubusercontent.com/u/5016479?v=4", + "profile": "https://github.com/Annyv2", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 88d0cce4d8265d1cfb9216c5d9041e15dc41c504 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:34:43 +0000 Subject: [PATCH 23/30] docs: update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b81ea2d..d3a6f33 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # socketio-jwt -[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
    ### Contributors @@ -12,6 +12,7 @@ Thanks goes to these wonderful people who contribute(d) or maintain(ed) this rep Conrad Sopala
    Conrad Sopala

    πŸ‘€ 🚧 Annyv2
    Annyv2

    πŸ’» + Vladyslav Martynets
    Vladyslav Martynets

    πŸ’» From 82c324e586fb763082e12a5c8558ebe02bbe5abc Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:34:44 +0000 Subject: [PATCH 24/30] docs: update .all-contributorsrc --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 452acc8..3ef8bc1 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -23,6 +23,15 @@ "contributions": [ "code" ] + }, + { + "login": "Amialc", + "name": "Vladyslav Martynets", + "avatar_url": "https://avatars0.githubusercontent.com/u/1114365?v=4", + "profile": "https://github.com/Amialc", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 91ba2424deddb1cb65a7082d784fa493a25db3f0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:35:21 +0000 Subject: [PATCH 25/30] docs: update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3a6f33..1eb8be7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # socketio-jwt -[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)
    ### Contributors @@ -13,6 +13,7 @@ Thanks goes to these wonderful people who contribute(d) or maintain(ed) this rep Conrad Sopala
    Conrad Sopala

    πŸ‘€ 🚧 Annyv2
    Annyv2

    πŸ’» Vladyslav Martynets
    Vladyslav Martynets

    πŸ’» + Alberto Pose
    Alberto Pose

    πŸ’» From f8ad92b396519fc171987dea66478c65a7656c0c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:35:22 +0000 Subject: [PATCH 26/30] docs: update .all-contributorsrc --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3ef8bc1..1a27b1c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -32,6 +32,15 @@ "contributions": [ "code" ] + }, + { + "login": "pose", + "name": "Alberto Pose", + "avatar_url": "https://avatars3.githubusercontent.com/u/419703?v=4", + "profile": "https://github.com/pose", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 0f639e4d002b0e43273afb0723f0da137260fe95 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:36:35 +0000 Subject: [PATCH 27/30] docs: update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1eb8be7..e631786 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # socketio-jwt -[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
    ### Contributors @@ -14,6 +14,7 @@ Thanks goes to these wonderful people who contribute(d) or maintain(ed) this rep Annyv2
    Annyv2

    πŸ’» Vladyslav Martynets
    Vladyslav Martynets

    πŸ’» Alberto Pose
    Alberto Pose

    πŸ’» + Root-Core
    Root-Core

    πŸ’» From ea7078077adab086a146b8acef1fd2da5d15da7c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:36:36 +0000 Subject: [PATCH 28/30] docs: update .all-contributorsrc --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 1a27b1c..3f8e778 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -41,6 +41,15 @@ "contributions": [ "code" ] + }, + { + "login": "Root-Core", + "name": "Root-Core", + "avatar_url": "https://avatars2.githubusercontent.com/u/5329652?v=4", + "profile": "https://github.com/Root-Core", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 4b4c336bb5c63d5dfcac2cd04790e2f843717fe3 Mon Sep 17 00:00:00 2001 From: Conrad Sopala Date: Tue, 23 Jul 2019 15:22:23 +0200 Subject: [PATCH 29/30] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e631786..51cbb80 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # socketio-jwt + [![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors) -
    +
    ### Contributors From 1e47810c9832fe40f7fd3233a5872984427f9829 Mon Sep 17 00:00:00 2001 From: Root-Core Date: Wed, 24 Jul 2019 15:55:12 +0200 Subject: [PATCH 30/30] Fixed merge error data was renamed to socket --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 0eb6f79..0ef276f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -173,7 +173,7 @@ function authorize(options, onConnection) { } // Store encoded JWT - data[options.encodedPropertyName] = token; + socket[options.encodedPropertyName] = token; var onJwtVerificationReady = function(err, decoded) {