File tree Expand file tree Collapse file tree 5 files changed +14
-5
lines changed
Expand file tree Collapse file tree 5 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1616 "@types/jszip" : " ^3.4.1" ,
1717 "@upstash/ratelimit" : " ^2.0.5" ,
1818 "archiver" : " ^7.0.1" ,
19- "better-auth" : " ^1.3.27 " ,
19+ "better-auth" : " ^1.4.5 " ,
2020 "class-variance-authority" : " ^0.7.1" ,
2121 "geist" : " ^1.3.1" ,
2222 "jszip" : " ^3.10.1" ,
Original file line number Diff line number Diff line change 22
33import { auth } from '@/app/lib/auth' ;
44import { createSafeActionClient } from 'next-safe-action' ;
5+ import { headers } from 'next/headers' ;
56import { z } from 'zod' ;
67
78const handleServerError = ( e : Error ) => {
@@ -28,7 +29,7 @@ const handleServerError = (e: Error) => {
2829 }
2930
3031 if ( errorMessage . includes ( 'too many attempts' ) ) {
31- return 'Too many requests. Please try again later.' ;
32+ return 'Too many requests. Please try again later.' ;
3233 }
3334
3435 // If we can't match a specific error, throw a generic but helpful message
@@ -46,11 +47,15 @@ export const login = createSafeActionClient({ handleServerError })
4647 } ) ,
4748 )
4849 . action ( async ( { parsedInput } ) => {
50+ const headersList = await headers ( ) ;
51+
4952 await auth . api . signInEmailOTP ( {
53+ headers : headersList ,
5054 body : {
5155 email : parsedInput . email ,
5256 otp : parsedInput . otp ,
5357 } ,
58+ asResponse : true ,
5459 } ) ;
5560
5661 return {
Original file line number Diff line number Diff line change @@ -12,9 +12,11 @@ export const auth = betterAuth({
1212 provider : 'postgresql' ,
1313 } ) ,
1414 advanced : {
15- // This will enable us to fall back to DB for ID generation.
16- // It's important so we can use custom IDs specified in Prisma Schema.
17- generateId : false ,
15+ database : {
16+ // This will enable us to fall back to DB for ID generation.
17+ // It's important so we can use custom IDs specified in Prisma Schema.
18+ generateId : false ,
19+ } ,
1820 } ,
1921 trustedOrigins : [ 'http://localhost:3000' , 'https://*.trycomp.ai' ] ,
2022 secret : env . AUTH_SECRET ! ,
Original file line number Diff line number Diff line change 88 "@types/cheerio": "^1.0.0",
99 "@types/react-syntax-highlighter": "^15.5.13",
1010 "@upstash/vector": "^1.2.2",
11+ "better-auth": "1.4.5",
1112 "cheerio": "^1.1.2",
1213 "react-syntax-highlighter": "^15.6.6",
1314 "unpdf": "^1.4.0",
Original file line number Diff line number Diff line change 9090 "@types/cheerio" : " ^1.0.0" ,
9191 "@types/react-syntax-highlighter" : " ^15.5.13" ,
9292 "@upstash/vector" : " ^1.2.2" ,
93+ "better-auth" : " 1.4.5" ,
9394 "cheerio" : " ^1.1.2" ,
9495 "react-syntax-highlighter" : " ^15.6.6" ,
9596 "unpdf" : " ^1.4.0" ,
You can’t perform that action at this time.
0 commit comments