aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-06 22:10:54 +0000
committerAdam Soltys <[email protected]>2023-01-06 22:10:54 +0000
commit8076c6c8da495331a6013671f80f178e57d42d19 (patch)
treeb67a18ae68bccaf2eec6b70bab0e45988dab2e31 /lib
parent8266d3adad8d093212b208ff93e6bee41f3370e3 (diff)
downloadcoinos-server-8076c6c8da495331a6013671f80f178e57d42d19.tar.gz
coinos-server-8076c6c8da495331a6013671f80f178e57d42d19.zip
still encode username in token
Diffstat (limited to 'lib')
-rw-r--r--lib/sockets.js4
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]);