mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
This commit is contained in:
parent
0ec019f959
commit
4cafc41b88
11 changed files with 192 additions and 77 deletions
14
src/auth.ts
14
src/auth.ts
|
|
@ -1,6 +1,7 @@
|
|||
import { betterAuth } from 'better-auth'
|
||||
import { prismaAdapter } from 'better-auth/adapters/prisma'
|
||||
import { username, bearer } from 'better-auth/plugins'
|
||||
import { DISCORD_OAUTH_ID, DISCORD_OAUTH_SECRET } from 'astro:env/server'
|
||||
|
||||
import prismaClient from './utils/prisma-client'
|
||||
import { sendEmail } from './utils/email'
|
||||
|
|
@ -11,6 +12,19 @@ export const auth = betterAuth({
|
|||
database: prismaAdapter(prismaClient, { provider: 'mysql' }),
|
||||
user: { modelName: 'users' },
|
||||
plugins: [username(), bearer()],
|
||||
account: {
|
||||
accountLinking: {
|
||||
enabled: true,
|
||||
allowDifferentEmails: true
|
||||
}
|
||||
},
|
||||
socialProviders: {
|
||||
discord: {
|
||||
clientId: DISCORD_OAUTH_ID,
|
||||
clientSecret: DISCORD_OAUTH_SECRET,
|
||||
scope: ['identify', 'email', 'guilds.members.read']
|
||||
}
|
||||
},
|
||||
emailVerification: {
|
||||
sendOnSignUp: true,
|
||||
autoSignInAfterVerification: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue