Path: blob/master/src/packages/next/pages/api/v2/auth/unlink-strategy.ts
1454 views
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/* api call to unlink a specific single sign on for the currently authenticated user */67import unlinkStrategy from "@cocalc/server/auth/sso/unlink-strategy";8import getAccountId from "lib/account/get-account";9import getParams from "lib/api/get-params";10import { OkStatus } from "lib/api/status";1112export default async function handle(req, res) {13try {14const account_id = await getAccountId(req);15if (!account_id) {16throw Error("must be signed in");17}18const { name } = getParams(req);19await unlinkStrategy({ account_id, name });20res.json(OkStatus);21} catch (err) {22res.json({ error: err.message });23}24}252627