Skip to content

Commit 8695c96

Browse files
fix: Remove broken callback.js + simplify Google OAuth flow
DELETED: - /api/auth/callback.js (was causing createClient error) FIXED: - /api/auth/google.js now redirects to /callback.html - Supabase Auth handles OAuth and redirects to static page - No server-side callback needed! NOW IT WILL WORK!
1 parent 5bc33ea commit 8695c96

File tree

2 files changed

+7
-299
lines changed

2 files changed

+7
-299
lines changed

cloud-bridge/api/auth/callback.js

Lines changed: 0 additions & 294 deletions
This file was deleted.

cloud-bridge/api/auth/google.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
/**
2-
* Google OAuth using Supabase Auth
3-
* Redirects to Supabase Auth which handles Google OAuth
2+
* Google OAuth - Redirect to Supabase Auth
43
*/
54

65
export default async function handler(req, res) {
76
const supabaseUrl = process.env.SUPABASE_URL;
87

98
if (!supabaseUrl) {
10-
return res.status(500).json({ error: 'Supabase not configured' });
9+
return res.status(500).json({ error: 'Supabase URL not configured' });
1110
}
1211

12+
// Build redirect URL back to our static callback page
13+
const redirectTo = `https://${req.headers.host}/callback.html`;
14+
1315
// Redirect to Supabase Auth with Google provider
14-
const redirectUrl = `${supabaseUrl}/auth/v1/authorize?provider=google&redirect_to=${encodeURIComponent(`https://${req.headers.host}/api/auth/callback`)}`;
16+
const authUrl = `${supabaseUrl}/auth/v1/authorize?provider=google&redirect_to=${encodeURIComponent(redirectTo)}`;
1517

16-
res.redirect(302, redirectUrl);
18+
res.redirect(302, authUrl);
1719
}

0 commit comments

Comments
 (0)