middleware
middleware copied to clipboard
@hono/clerk-auth empty response when JWT is expired
Hello,
I am using the @hono/clerk-auth package in my project. It works very well so far.
- If a valid jwt is given, it responds with
You are logged in!. - If no jwt is given, it responds with
You are not logged in. - But if an expired jwt is given, it responds with an empty body. In this case I also want to respond with
You are not logged in.
This is my code:
app.use('/payment/*', clerkMiddleware())
app.post('/payment/billing', (c) => {
const auth = getAuth(c)
console.log('auth', auth)
if (!auth?.userId) {
return c.json({
message: 'You are not logged in.',
})
}
return c.json({
message: 'You are logged in!',
user: auth,
})
})
Kind regards, Marius
@mariusbolik the upgraded version of the middleware that uses Clerk Core v2 is now available. Could you please update and confirm the issue persists with the new version?