"use strict";
/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* api call to unlink a specific single sign on for the currently authenticated user */
const unlink_strategy_1 = __importDefault(require("@cocalc/server/auth/sso/unlink-strategy"));
const get_account_1 = __importDefault(require("lib/account/get-account"));
const get_params_1 = __importDefault(require("lib/api/get-params"));
async function handle(req, res) {
    try {
        const account_id = await (0, get_account_1.default)(req);
        if (!account_id) {
            throw Error("must be signed in");
        }
        const { name } = (0, get_params_1.default)(req);
        await (0, unlink_strategy_1.default)({ account_id, name });
        res.json({ status: "ok" });
    }
    catch (err) {
        res.json({ error: err.message });
    }
}
exports.default = handle;
//# sourceMappingURL=unlink-strategy.js.map