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:
@@ -1,6 +1,6 @@
|
|||||||
SUPABASE_PROJECT_ID="fvjpfhfgkhgtwtzrgcgx"
|
SUPABASE_PROJECT_ID="qgmcpounpkgsjlwosjdi"
|
||||||
SUPABASE_PUBLISHABLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ2anBmaGZna2hndHd0enJnY2d4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODI4NDE0NDIsImV4cCI6MjA5ODQxNzQ0Mn0.B7dh8P2ZfUbJMtAGVbbRyyNFk71oqhJuqd0BNki-Dqk"
|
SUPABASE_PUBLISHABLE_KEY="sb_publishable_NTbfdVFqAuqLls0rg6GFWA_vVcuIglp"
|
||||||
SUPABASE_URL="https://fvjpfhfgkhgtwtzrgcgx.supabase.co"
|
SUPABASE_URL="https://qgmcpounpkgsjlwosjdi.supabase.co"
|
||||||
VITE_SUPABASE_PROJECT_ID="fvjpfhfgkhgtwtzrgcgx"
|
VITE_SUPABASE_PROJECT_ID="qgmcpounpkgsjlwosjdi"
|
||||||
VITE_SUPABASE_PUBLISHABLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ2anBmaGZna2hndHd0enJnY2d4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODI4NDE0NDIsImV4cCI6MjA5ODQxNzQ0Mn0.B7dh8P2ZfUbJMtAGVbbRyyNFk71oqhJuqd0BNki-Dqk"
|
VITE_SUPABASE_PUBLISHABLE_KEY="sb_publishable_NTbfdVFqAuqLls0rg6GFWA_vVcuIglp"
|
||||||
VITE_SUPABASE_URL="https://fvjpfhfgkhgtwtzrgcgx.supabase.co"
|
VITE_SUPABASE_URL="https://qgmcpounpkgsjlwosjdi.supabase.co"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ lerna-debug.log*
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
|
|
||||||
|
# Supabase CLI local state
|
||||||
|
supabase/.temp
|
||||||
|
supabase/.branches
|
||||||
.output
|
.output
|
||||||
.vinxi
|
.vinxi
|
||||||
.tanstack/**
|
.tanstack/**
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"template": "tanstack_start_ts_current",
|
|
||||||
"revision": "tanstack_start_ts_current-40f3c252c0da"
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
"name": "tanstack_start_ts",
|
"name": "tanstack_start_ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^5.2.2",
|
"@hookform/resolvers": "^5.2.2",
|
||||||
"@lovable.dev/cloud-auth-js": "^1.1.2",
|
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||||
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
||||||
@@ -232,8 +231,6 @@
|
|||||||
|
|
||||||
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
||||||
|
|
||||||
"@lovable.dev/cloud-auth-js": ["@lovable.dev/cloud-auth-js@1.1.2", "https://europe-west1-npm.pkg.dev/lovable-core-prod/sandbox-npm-cache/@lovable.dev/cloud-auth-js/-/cloud-auth-js-1.1.2.tgz", {}, "sha512-xz8ocewsgwkp8giau272/eWWU3XrchCg5uba4yQPPYtevHTXaVU3sD+fO1JjyPBHacVcOcwhmgUiU9TKHt63cg=="],
|
|
||||||
|
|
||||||
"@lovable.dev/vite-plugin-dev-server-bridge": ["@lovable.dev/vite-plugin-dev-server-bridge@1.0.2", "", { "peerDependencies": { "vite": ">=5.0.0 <9.0.0" } }, "sha512-1c4XLFkpS614VxPyq+IX0us52vm5JWxdO1NfG2L1FjH0asKvHNu5//6wpnKHWmx60Y4HR1gcLaIiLACXIdeFyg=="],
|
"@lovable.dev/vite-plugin-dev-server-bridge": ["@lovable.dev/vite-plugin-dev-server-bridge@1.0.2", "", { "peerDependencies": { "vite": ">=5.0.0 <9.0.0" } }, "sha512-1c4XLFkpS614VxPyq+IX0us52vm5JWxdO1NfG2L1FjH0asKvHNu5//6wpnKHWmx60Y4HR1gcLaIiLACXIdeFyg=="],
|
||||||
|
|
||||||
"@lovable.dev/vite-plugin-hmr-gate": ["@lovable.dev/vite-plugin-hmr-gate@1.1.1", "https://europe-west1-npm.pkg.dev/lovable-core-prod/sandbox-npm-cache/@lovable.dev/vite-plugin-hmr-gate/-/vite-plugin-hmr-gate-1.1.1.tgz", { "peerDependencies": { "vite": ">=5.0.0 <9.0.0" } }, "sha512-ySRUzOoGQYhj4Pd9EjaA7i1+2RiaS5lSVZasun72wVZZmJfFIciGYGQQDUu88HISn4icz0sugQxFRJGCNlTggg=="],
|
"@lovable.dev/vite-plugin-hmr-gate": ["@lovable.dev/vite-plugin-hmr-gate@1.1.1", "https://europe-west1-npm.pkg.dev/lovable-core-prod/sandbox-npm-cache/@lovable.dev/vite-plugin-hmr-gate/-/vite-plugin-hmr-gate-1.1.1.tgz", { "peerDependencies": { "vite": ">=5.0.0 <9.0.0" } }, "sha512-ySRUzOoGQYhj4Pd9EjaA7i1+2RiaS5lSVZasun72wVZZmJfFIciGYGQQDUu88HISn4icz0sugQxFRJGCNlTggg=="],
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^5.2.2",
|
"@hookform/resolvers": "^5.2.2",
|
||||||
"@lovable.dev/cloud-auth-js": "^1.1.2",
|
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||||
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
||||||
|
|||||||
@@ -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;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -307,3 +307,13 @@ const rootRouteChildren: RootRouteChildren = {
|
|||||||
export const routeTree = rootRouteImport
|
export const routeTree = rootRouteImport
|
||||||
._addFileChildren(rootRouteChildren)
|
._addFileChildren(rootRouteChildren)
|
||||||
._addFileTypes<FileRouteTypes>()
|
._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
@@ -2,7 +2,6 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { supabase } from "@/integrations/supabase/client";
|
import { supabase } from "@/integrations/supabase/client";
|
||||||
import { lovable } from "@/integrations/lovable";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
@@ -51,9 +50,14 @@ function AuthPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onGoogle = async () => {
|
const onGoogle = async () => {
|
||||||
const res = await lovable.auth.signInWithOAuth("google", { redirect_uri: window.location.origin });
|
// Native Supabase OAuth: redirects the browser to Google, then back to
|
||||||
if (res.error) toast.error(res.error.message ?? "Google sign-in failed");
|
// redirectTo. supabase-js (detectSessionInUrl) restores the session on
|
||||||
else if (!res.redirected) navigate({ to: "/dashboard" });
|
// 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 (
|
return (
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
project_id = "fvjpfhfgkhgtwtzrgcgx"
|
project_id = "qgmcpounpkgsjlwosjdi"
|
||||||
|
|||||||
Reference in New Issue
Block a user