adonisjs/auth

Question: How to validade an API token outside of a HTTP request

un-versed opened this issue · 1 comments

It's possible to check an api token outside of a HTTP request?

I'm trying to implement socket.io server in my existing adonis application, but I didn't figure out how to authenticate the socket.io connection.

I already have the token input, I just need to verify it

Ws.io.use((socket, next) => {
  const token = socket.handshake.auth.token

  if (token) {
    console.log(token)
  }
  
  next()
})

Any tips on this?