import { setSecret } from '../../../../../lib/secrets.js';
import { appendAudit } from '../../../../../lib/runtime.js';
export const dynamic='force-dynamic'; export const runtime='nodejs';
export async function GET(request){ const u=new URL(request.url); const project_id=u.searchParams.get('state')||null; const token=u.searchParams.get('refresh_token') || u.searchParams.get('code') || 'oauth-code-received'; setSecret('GOOGLE_REFRESH_TOKEN', token, { project_id, source:'oauth_refresh' }); appendAudit({type:'google.oauth',summary:'Google OAuth token stored',status:'complete',meta:{project_id}}); return Response.redirect(`${u.origin}/projects/${project_id || 'personal'}`); }
