export const dynamic='force-dynamic'; export const runtime='nodejs';
export async function GET(request){ const u=new URL(request.url); const project=u.searchParams.get('project_id')||'global'; const params=new URLSearchParams({client_id:process.env.GOOGLE_CLIENT_ID||'missing-client-id',redirect_uri:process.env.GOOGLE_REDIRECT_URI||`${u.origin}/api/integrations/google/callback`,response_type:'code',access_type:'offline',prompt:'consent',scope:'https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/gmail.send',state:project}); return Response.redirect(`https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`); }
