1.1.0 • Published 10 months ago
@elysiajs/lucia-auth v1.1.0
Experimental package, DO NOT USE
@elysiajs/lucia-auth
Plugin for elysia authentication using Lucia
Installation
bun add @elysiajs/lucia-auth
Example
const { elysia, lucia, oauth } = Lucia({
adapter: adapter(new PrismaClient())
})
const auth = new Elysia({ prefix: '/auth' })
.use(elysia)
.use(
oauth.github({
clientId: GH_CLIENT_ID,
clientSecret: GH_CLIENT_SECRET
})
)
.guard(
{
body: t.Object({
username: t.String(),
password: t.String()
})
},
(app) =>
app
.put('/sign-up', async ({ body, user }) => user.signUp(body))
.post(
'/sign-in',
async ({ user, body: { username, password } }) => {
await user.signIn(username, password)
return `Sign in as ${username}`
}
)
)
.guard(
{
beforeHandle: ({ user: { validate } }) => validate()
},
(app) =>
app
.get('/profile', ({ user }) => user.data)
.delete('/profile', async ({ user }) => {
await user.delete({
'confirm': 'DELETE ALL USER DATA and is not reversible'
})
return 'Signed out'
})
.get('/sign-out', async ({ user }) => {
await user.signOut()
return 'Signed out'
})
)
1.1.0
10 months ago
1.1.0-exp.1
12 months ago
1.1.0-exp.0
12 months ago
1.1.0-rc.0
12 months ago
1.0.2
1 year ago
1.0.3
1 year ago
1.0.0-exp.0
1 year ago
0.8.0-exp.1
2 years ago
0.8.0-exp.0
2 years ago
0.7.0-exp.0
2 years ago
0.7.0-exp.1
2 years ago
0.0.0-exp-20230623.312
2 years ago
0.0.0-exp-20230623.305
2 years ago
0.0.0-exp-20230623.251
2 years ago
0.0.0-exp-20230621.2
2 years ago
0.0.0-exp-20230620.2056
2 years ago
0.0.0-exp-20230620.2037
2 years ago
0.0.0-exp-20230620.2031
2 years ago
0.0.0-exp-20230620.1756
2 years ago
0.0.0-exp-20230620.1749
2 years ago