Skip to content

How to use JWT with secrets via Cloudflare #801

Answered by yusukebe
yusukebe asked this question in Q&A
Discussion options

You must be logged in to vote

We can write the following way:

type Bindings = {
  JWT_TOKEN_KEY: string
}

const app = new Hono<{ Bindings: Bindings }>()
app.use('/*', async (c, next) => {
  const jwtMiddleware = jwt({
    secret: c.env.JWT_TOKEN_KEY,
  })
  return jwtMiddleware(c, next)
})

Replies: 2 comments

Comment options

yusukebe
Jan 12, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by yusukebe
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants