Closed kilobyte2007 closed 7 months ago
Hey @kilobyte2007! 👋🏻
If you are not using the silent auth middleware, you will have first to authenticate the user:
transmit.authorizeChannel<{ id: string }>('users/:id', async (ctx: HttpContext, { id }) => {
await auth.check()
console.log('id', id)
console.log('user', ctx.auth.user)
return ctx.auth.user?.id === +id
})
Wow! Didn't know about the silent auth middleware. Works perfectly now. Thanks so much!
Nice!
Package version
0.4.2
Describe the bug
I am trying to make a channel private like in the README example but it looks like the auth.user is always undefined within the callback function.
This is my code:
And this is the log output:
It's probably worth noting that I am logged in and other requests are working fine.
Seems to me like there's a configuration that I've missed but I am pretty sure I have configured everything like this in the docs. Is there something I am missing?
Thanks a lot in advance.
Here are my package versions:
Reproduction repo
No response