Clerk and Adonis authentication code example #3393
Closed
Answered
by
wobsoriano
ivanvinicius
asked this question in
Support request - DO NOT OPEN HERE
-
I'm trying to find some example of authentication with Clerk and Adonis. But I didn't find any. Does anyone know a repository, git-gist or forum thread that can help me? Any example will be useful. I'm using adonis v5.8 and the latest version of clerk. thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
wobsoriano
May 17, 2024
Replies: 1 comment 2 replies
-
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)
}) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ivanvinicius
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: