File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import "server-only";
22
33import { cache } from "react" ;
44import { headers } from "next/headers" ;
5+ import { nextCookies } from "better-auth/next-js" ;
56
67import { initAuth } from "@acme/auth" ;
78
@@ -20,6 +21,7 @@ export const auth = initAuth({
2021 secret : env . AUTH_SECRET ,
2122 discordClientId : env . AUTH_DISCORD_ID ,
2223 discordClientSecret : env . AUTH_DISCORD_SECRET ,
24+ extraPlugins : [ nextCookies ( ) ] ,
2325} ) ;
2426
2527export const getSession = cache ( async ( ) =>
Original file line number Diff line number Diff line change 1- import type { BetterAuthOptions } from "better-auth" ;
1+ import type { BetterAuthOptions , BetterAuthPlugin } from "better-auth" ;
22import { expo } from "@better-auth/expo" ;
33import { betterAuth } from "better-auth" ;
44import { drizzleAdapter } from "better-auth/adapters/drizzle" ;
55import { oAuthProxy } from "better-auth/plugins" ;
66
77import { db } from "@acme/db/client" ;
88
9- export function initAuth ( options : {
9+ export function initAuth <
10+ TExtraPlugins extends BetterAuthPlugin [ ] = [ ] ,
11+ > ( options : {
1012 baseUrl : string ;
1113 productionUrl : string ;
1214 secret : string | undefined ;
1315
1416 discordClientId : string ;
1517 discordClientSecret : string ;
18+ extraPlugins ?: TExtraPlugins ;
1619} ) {
1720 const config = {
1821 database : drizzleAdapter ( db , {
@@ -25,6 +28,7 @@ export function initAuth(options: {
2528 productionURL : options . productionUrl ,
2629 } ) ,
2730 expo ( ) ,
31+ ...( options . extraPlugins ?? [ ] ) ,
2832 ] ,
2933 socialProviders : {
3034 discord : {
You can’t perform that action at this time.
0 commit comments