diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sockets.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sockets.js b/lib/sockets.js index 7498db62..3bd0c2c2 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -92,8 +92,8 @@ app.register(async function(app) { try { if (!token || token === "null" || !jwt.decode(token)) return ws.close(code, `bad token ${token}`); - const username = jwt.decode(token).username; - if (!username) throw new Error("Invalid JWT token"); + const { username, uuid } = jwt.decode(token); + if (!(username || uuid)) throw new Error("Invalid JWT token"); if (!store.sockets[username]) store.sockets[username] = {}; const existing = Object.keys(store.sockets[username]); |
