Created
May 18, 2025 13:13
-
-
Save PhantomKnight287/4a9dacf98ca62d49368fdfc9cc282ffe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { betterAuth, logger } from "better-auth"; | |
| import { | |
| admin, | |
| anonymous, | |
| apiKey, | |
| bearer, | |
| captcha, | |
| createAuthMiddleware, | |
| emailOTP, | |
| haveIBeenPwned, | |
| magicLink, | |
| multiSession, | |
| oneTimeToken, | |
| openAPI, | |
| organization, | |
| phoneNumber, | |
| twoFactor, | |
| username, | |
| } from "better-auth/plugins"; | |
| import { db } from "./db.js"; | |
| import { expo } from "@better-auth/expo"; | |
| import { passkey } from "better-auth/plugins/passkey"; | |
| export const auth = betterAuth({ | |
| emailAndPassword: { | |
| enabled: true, | |
| }, | |
| plugins: [ | |
| bearer(), | |
| openAPI({}), | |
| expo(), | |
| twoFactor(), | |
| username(), | |
| anonymous(), | |
| phoneNumber({ | |
| sendOTP(data) { | |
| console.log(data); | |
| }, | |
| }), | |
| magicLink({ | |
| async sendMagicLink(data, request) { | |
| console.log(data, request); | |
| }, | |
| }), | |
| emailOTP({ | |
| async sendVerificationOTP(data, request) { | |
| console.log(data, request); | |
| }, | |
| }), | |
| passkey(), | |
| admin(), | |
| apiKey(), | |
| organization(), | |
| oneTimeToken({}), | |
| ], | |
| socialProviders: { | |
| github: { | |
| clientId: process.env.GITHUB_CLIENT_ID!, | |
| clientSecret: process.env.GITHUB_CLIENT_SECRET!, | |
| }, | |
| }, | |
| database: db, | |
| trustedOrigins: [ | |
| "bac://fyi.procrastinator.better-auth-client", | |
| "bac://", | |
| "http://localhost:3000", | |
| ], | |
| hooks: {}, | |
| user: { | |
| additionalFields: { | |
| premium: { | |
| type: "boolean", | |
| defaultValue: false, | |
| required: false, | |
| }, | |
| }, | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment