Skip to content

Restricting bearer auth to route + HTTP verb? #793

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

You must be logged in to vote

Hi @VirtualWolf !

You can write like the following:

app.get('/api/posts', (c) => {
  return c.text('Read Posts!')
})

app.post('/api/post', bearerAuth({ token: 'foo' }), (c) => {
  return c.text('Post Created!', 201)
})

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@VirtualWolf
Comment options

@yusukebe
Comment options

@VirtualWolf
Comment options

@yusukebe
Comment options

Answer selected by VirtualWolf
Comment options

You must be logged in to vote
2 replies
@yusukebe
Comment options

@alexjohndoe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants