The open-source CapCut alternative
fix: set redirect uri for google login and prevent router push when login by google
fathisiddiqi6626a8c41355
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.mdindex b9e22759..120a3ce4 100644--- a/.github/CONTRIBUTING.md+++ b/.github/CONTRIBUTING.md@@ -87,6 +87,7 @@ Thank you for your interest in contributing to OpenCut! This document provides g# Only needed if you want to test Google loginGOOGLE_CLIENT_ID="your-google-client-id"GOOGLE_CLIENT_SECRET="your-google-client-secret"+ GOOGLE_REDIRECT_URI="http://localhost:3000/api/auth/callback/google"```5. Run database migrations: `bun run db:migrate`diff --git a/apps/web/.env.example b/apps/web/.env.exampleindex 0b4c649b..70c48e2a 100644--- a/apps/web/.env.example+++ b/apps/web/.env.example@@ -10,6 +10,7 @@ BETTER_AUTH_SECRET=your-secret-key-here#Google ClientsGOOGLE_CLIENT_ID=GOOGLE_CLIENT_SECRET=+GOOGLE_REDIRECT_URI=http://localhost:3000/api/auth/callback/google# Development EnvironmentNODE_ENV=developmentdiff --git a/apps/web/src/app/(auth)/login/page.tsx b/apps/web/src/app/(auth)/login/page.tsxindex 73c34e1e..755784fa 100644--- a/apps/web/src/app/(auth)/login/page.tsx+++ b/apps/web/src/app/(auth)/login/page.tsx@@ -52,8 +52,8 @@ function LoginForm() {try {await signIn.social({provider: "google",+ callbackURL: "/editor",});- router.push("/editor");} catch (error) {setError("Failed to sign in with Google. Please try again.");setIsGoogleLoading(false);diff --git a/packages/auth/src/server.ts b/packages/auth/src/server.tsindex f6c68dc5..7c32fbf5 100644--- a/packages/auth/src/server.ts+++ b/packages/auth/src/server.ts@@ -16,14 +16,15 @@ export const auth = betterAuth({emailAndPassword: {enabled: true,},- socialProviders: {+ socialProviders: {google: {clientId: process.env.GOOGLE_CLIENT_ID as string,clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,+ redirectURI: process.env.GOOGLE_REDIRECT_URI as string,},},appName: "OpenCut",trustedOrigins: ["http://localhost:3000"],});-export type Auth = typeof auth;\ No newline at end of file+export type Auth = typeof auth;