Skip to content

Clerk and Adonis authentication code example #3393

Discussion options

You must be logged in to vote

Check this example - https://github.com/wobsoriano/adonis-clerk-example

There is a custom Clerk Middleware that'll inject an auth object to the http context:

router.get('/api/me', (ctx) => {
  const { userId } = ctx.request.auth

  if (!userId) {
    return ctx.response.status(401).send('Unauthorized')
  }

  return ctx.response.json(ctx.request.auth)
})

Replies: 1 comment 2 replies

Comment options

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

@ivanvinicius
Comment options

Answer selected by ivanvinicius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants