Files

21 lines
716 B
TypeScript

/**
* POST /api/integrations/github/disconnect
*
* Drops the stored GitHub access token + login from the user's
* fs_users record. Does NOT revoke the OAuth grant on GitHub itself —
* users can do that from https://github.com/settings/applications.
*/
import { NextResponse } from "next/server";
import { authSession } from "@/lib/auth/session-server";
import { disconnectGithubIntegration } from "@/lib/integrations/github";
export async function POST() {
const session = await authSession();
if (!session?.user?.email) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
await disconnectGithubIntegration(session.user.email);
return NextResponse.json({ ok: true });
}