Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@hono/clerk-auth empty response when JWT is expired #450

Open
mariusbolik opened this issue Apr 12, 2024 · 1 comment
Open

@hono/clerk-auth empty response when JWT is expired #450

mariusbolik opened this issue Apr 12, 2024 · 1 comment

Comments

@mariusbolik
Copy link

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

@MonsterDeveloper
Copy link
Contributor

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants