Files
Chris CarusoandClaude Sonnet 4.5 b78d05b89f feat: implement SupaBuilder - enterprise self-service Supabase project provisioning
• Database schema with RLS policies for admin/builder roles
• Edge function for creating Pico projects via Management API
• SSO authentication with Google OAuth support
• Auto-assignment of admin role to first user per organization
• Next.js UI with project creation, listing, and detail views
• Rate limiting (configurable), audit logging, and encrypted credentials
• Server actions for project management operations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-31 14:42:37 -06:00

32 lines
935 B
TypeScript

/**
* Auth Callback Route
*
* Handles the OAuth callback after successful authentication.
* Exchanges the code for a session and redirects to the projects page.
*/
import { createClient } from '@/lib/supabase/server'
import { NextResponse } from 'next/server'
export async function GET(request: Request) {
const requestUrl = new URL(request.url)
const code = requestUrl.searchParams.get('code')
const origin = requestUrl.origin
if (code) {
const supabase = await createClient()
// Exchange the code for a session
const { error } = await supabase.auth.exchangeCodeForSession(code)
if (error) {
console.error('Auth callback error:', error)
// Redirect to login with error
return NextResponse.redirect(`${origin}/login?error=${encodeURIComponent(error.message)}`)
}
}
// URL to redirect to after sign in process completes
return NextResponse.redirect(`${origin}/projects`)
}