Skip to content

Commit

Permalink
not throw error on missing auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacper-RF committed Oct 10, 2023
1 parent 8913c3d commit a02a23e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/backend/src/nest/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ export class AppModule {
io.use((socket, next) => {
const authToken = socket.handshake.headers['authorization']
const socketIOToken = authToken && authToken.split(' ')[1]

if (!socketIOToken) {
throw new Error('no auth token')
console.error('No auth token')
return
}
console.error({ socketIOToken })
if (verifyJWT(socketIOToken)) {
next()
} else {
new Error('Socket authentication error')
return
}
})
return { server, io }
Expand Down

0 comments on commit a02a23e

Please sign in to comment.