From 6f704f73f189725b441b221e93449a85c58bf966 Mon Sep 17 00:00:00 2001 From: Mariano Fuentes Date: Tue, 29 Apr 2025 15:48:02 -0400 Subject: [PATCH 1/2] add trusted origins --- apps/app/src/utils/auth.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/app/src/utils/auth.ts b/apps/app/src/utils/auth.ts index 8c4b54d829..eadbefd403 100644 --- a/apps/app/src/utils/auth.ts +++ b/apps/app/src/utils/auth.ts @@ -35,6 +35,11 @@ export const auth = betterAuth({ database: prismaAdapter(db, { provider: "postgresql", }), + trustedOrigins: [ + "http://localhost:3000", + "https://app.trycomp.ai", + "https://dev.trycomp.ai", + ], advanced: { database: { // This will enable us to fall back to DB for ID generation. From e194f61c2fc0dc596add0e4a563f39b240b332e8 Mon Sep 17 00:00:00 2001 From: Mariano Fuentes Date: Tue, 29 Apr 2025 15:58:13 -0400 Subject: [PATCH 2/2] Add support for dynamic callback URL in Google sign-in flow --- apps/app/src/components/google-sign-in.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/app/src/components/google-sign-in.tsx b/apps/app/src/components/google-sign-in.tsx index 47e7837e2e..be899eb860 100644 --- a/apps/app/src/components/google-sign-in.tsx +++ b/apps/app/src/components/google-sign-in.tsx @@ -23,8 +23,11 @@ export function GoogleSignIn({ ? `/api/auth/invitation?code=${inviteCode}` : "/"; + const callbackURL = new URL(redirectTo, window.location.origin); + await authClient.signIn.social({ provider: "google", + callbackURL: callbackURL.toString(), }); };