File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 "@dnd-kit/sortable" : " ^10.0.0" ,
2121 "@dnd-kit/utilities" : " ^3.2.2" ,
2222 "@dub/analytics" : " ^0.0.27" ,
23+ "@dub/better-auth" : " ^0.0.3" ,
2324 "@dub/embed-react" : " ^0.0.15" ,
2425 "@hookform/resolvers" : " ^5.1.1" ,
2526 "@mendable/firecrawl-js" : " ^1.24.0" ,
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ async function handleLogin(request: NextRequest) {
173173 // Copy all cookies from Better Auth's response to our response
174174 const cookies = signInResponse . headers . getSetCookie ( ) ;
175175 console . log ( '[TEST-LOGIN] Setting cookies count:' , cookies . length ) ;
176- cookies . forEach ( ( cookie ) => {
176+ cookies . forEach ( ( cookie : string ) => {
177177 response . headers . append ( 'Set-Cookie' , cookie ) ;
178178 } ) ;
179179
Original file line number Diff line number Diff line change @@ -3,12 +3,20 @@ import { db } from '@comp/db';
33import { MagicLinkEmail , OTPVerificationEmail } from '@comp/email' ;
44import { sendInviteMemberEmail } from '@comp/email/lib/invite-member' ;
55import { sendEmail } from '@comp/email/lib/resend' ;
6+ import { dubAnalytics } from '@dub/better-auth' ;
67import { betterAuth } from 'better-auth' ;
78import { prismaAdapter } from 'better-auth/adapters/prisma' ;
89import { nextCookies } from 'better-auth/next-js' ;
910import { emailOTP , magicLink , organization } from 'better-auth/plugins' ;
11+ import { Dub } from 'dub' ;
1012import { ac , allRoles } from './permissions' ;
1113
14+ const dub = env . DUB_API_KEY
15+ ? new Dub ( {
16+ token : env . DUB_API_KEY ,
17+ } )
18+ : undefined ;
19+
1220let socialProviders = { } ;
1321
1422if ( env . AUTH_GOOGLE_ID && env . AUTH_GOOGLE_SECRET ) {
@@ -140,6 +148,7 @@ export const auth = betterAuth({
140148 } ,
141149 } ) ,
142150 nextCookies ( ) ,
151+ ...( dub ? [ dubAnalytics ( { dubClient : dub } ) ] : [ ] ) ,
143152 ] ,
144153 socialProviders,
145154 user : {
You can’t perform that action at this time.
0 commit comments