You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently implementing authentication in my application using the Bearer Auth Middleware. I'm interested in accessing additional information about the user associated with the token. Does this functionality only work when using JWT (JSON Web Tokens)?
Example:
import { Hono } from 'https://deno.land/x/hono/mod.ts'
import { bearerAuth } from 'https://deno.land/x/hono/middleware.ts'
const app = new Hono()
const token = 'honoiscool'
app.use(
'/auth-verify-token/*',
bearerAuth({
verifyToken: async (token, c) => {
// How to pass user from here to request?
return token === dbQuery
},
})
)
app.get('/auth-verify-token/page', (c) => {
return c.json({ message: `Your user id is ${c.user.id}` })
})
Thanks.
The text was updated successfully, but these errors were encountered:
I am currently implementing authentication in my application using the Bearer Auth Middleware. I'm interested in accessing additional information about the user associated with the token. Does this functionality only work when using JWT (JSON Web Tokens)?
Example:
Thanks.
The text was updated successfully, but these errors were encountered: