diff options
| author | Adam Soltys <[email protected]> | 2021-07-08 15:14:57 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-07-08 15:14:57 -0400 |
| commit | 8a554b6d3085efc3e4b062bdb0ac61cc0ce89416 (patch) | |
| tree | 13b719e3e49a7dd5055553fd0d27417fd2abfe0e | |
| parent | 9e6091525bfa1e068fa4592b48acd8fa9d8a7fc5 (diff) | |
| download | coinos-server-8a554b6d3085efc3e4b062bdb0ac61cc0ce89416.tar.gz coinos-server-8a554b6d3085efc3e4b062bdb0ac61cc0ce89416.zip | |
check that token can decode properly
| -rw-r--r-- | lib/sockets.js | 2 |
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"); |
