Migrate backend from Lovable Cloud to own Supabase (EDU project)

- Point .env + supabase/config.toml at EDU (qgmcpounpkgsjlwosjdi)
- Replace Lovable Google-OAuth shim with native supabase.auth.signInWithOAuth
- Remove src/integrations/lovable and @lovable.dev/cloud-auth-js dependency
- Drop .lovable metadata; gitignore supabase/.temp

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 18:04:18 -04:00
co-authored by Claude Opus 4.8
parent c36d2b24e9
commit 45d36827d2
9 changed files with 29 additions and 58 deletions
-38
View File
@@ -1,38 +0,0 @@
// This file is auto-generated by Lovable. Do not modify it.
import { createLovableAuth } from "@lovable.dev/cloud-auth-js";
import { supabase } from "../supabase/client";
const lovableAuth = createLovableAuth();
type SignInOptions = {
redirect_uri?: string;
extraParams?: Record<string, string>;
};
export const lovable = {
auth: {
signInWithOAuth: async (provider: "google" | "apple" | "microsoft" | "lovable", opts?: SignInOptions) => {
const result = await lovableAuth.signInWithOAuth(provider, {
redirect_uri: opts?.redirect_uri,
extraParams: {
...opts?.extraParams,
},
});
if (result.redirected) {
return result;
}
if (result.error) {
return result;
}
try {
await supabase.auth.setSession(result.tokens);
} catch (e) {
return { error: e instanceof Error ? e : new Error(String(e)) };
}
return result;
},
},
};
+10
View File
@@ -307,3 +307,13 @@ const rootRouteChildren: RootRouteChildren = {
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
import type { getRouter } from './router.tsx'
import type { startInstance } from './start.ts'
declare module '@tanstack/react-start' {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
config: Awaited<ReturnType<typeof startInstance.getOptions>>
}
}
+8 -4
View File
@@ -2,7 +2,6 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router";
import { useState } from "react";
import { z } from "zod";
import { supabase } from "@/integrations/supabase/client";
import { lovable } from "@/integrations/lovable";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -51,9 +50,14 @@ function AuthPage() {
};
const onGoogle = async () => {
const res = await lovable.auth.signInWithOAuth("google", { redirect_uri: window.location.origin });
if (res.error) toast.error(res.error.message ?? "Google sign-in failed");
else if (!res.redirected) navigate({ to: "/dashboard" });
// Native Supabase OAuth: redirects the browser to Google, then back to
// redirectTo. supabase-js (detectSessionInUrl) restores the session on
// return, and useAuth's onAuthStateChange picks it up.
const { error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: { redirectTo: `${window.location.origin}/dashboard` },
});
if (error) toast.error(error.message ?? "Google sign-in failed");
};
return (