mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
WIP
This commit is contained in:
parent
c3fca425cb
commit
392d6b6e51
5 changed files with 62 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { betterAuth } from 'better-auth'
|
||||
import { prismaAdapter } from 'better-auth/adapters/prisma'
|
||||
import { username } from 'better-auth/plugins'
|
||||
import { username, apiKey } from 'better-auth/plugins'
|
||||
|
||||
import prismaClient from './utils/prisma-client'
|
||||
import { sendEmail } from 'utils/email'
|
||||
|
|
@ -10,7 +10,7 @@ import verifyTemplate from 'utils/verifyTemplate'
|
|||
export const auth = betterAuth({
|
||||
database: prismaAdapter(prismaClient, { provider: 'mysql' }),
|
||||
user: { modelName: 'users' },
|
||||
plugins: [username()],
|
||||
plugins: [username(), apiKey()],
|
||||
emailVerification: {
|
||||
sendOnSignUp: true,
|
||||
autoSignInAfterVerification: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { createAuthClient } from 'better-auth/client'
|
||||
import { usernameClient } from 'better-auth/client/plugins'
|
||||
import { apiKeyClient, usernameClient } from 'better-auth/client/plugins'
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
plugins: [usernameClient()]
|
||||
plugins: [usernameClient(), apiKeyClient()]
|
||||
})
|
||||
export const { useSession, signIn, signUp, signOut, forgetPassword, resetPassword } = authClient
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue