aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sockets.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-07-08 15:14:57 -0400
committerAdam Soltys <[email protected]>2021-07-08 15:14:57 -0400
commit8a554b6d3085efc3e4b062bdb0ac61cc0ce89416 (patch)
tree13b719e3e49a7dd5055553fd0d27417fd2abfe0e /lib/sockets.js
parent9e6091525bfa1e068fa4592b48acd8fa9d8a7fc5 (diff)
downloadcoinos-server-8a554b6d3085efc3e4b062bdb0ac61cc0ce89416.tar.gz
coinos-server-8a554b6d3085efc3e4b062bdb0ac61cc0ce89416.zip
check that token can decode properly
Diffstat (limited to 'lib/sockets.js')
-rw-r--r--lib/sockets.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sockets.js b/lib/sockets.js
index 931a9d23..bd59ee38 100644
--- a/lib/sockets.js
+++ b/lib/sockets.js
@@ -96,7 +96,7 @@ wss.on("connection", function(ws, req) {
lastSeen[token] = new Date();
try {
- if (!token || token === "null") return ws.close();
+ if (!token || token === "null" || !jwt.decode(token)) return ws.close();
const username = jwt.decode(token).username;
if (!username) throw new Error("Invalid JWT token");