Fixes missing slack credentials
This commit is contained in:
1 parent
4437bfa840
commit
af9612968b
2 files changed
+10
-7
No files matched your search
@@ -5,11 +5,6 @@ import _package from "./package.json";
|
|||||||
export const metadata = {
|
export const metadata = {
|
||||||
name: "Slack App",
|
name: "Slack App",
|
||||||
description: _package.description,
|
description: _package.description,
|
||||||
installed: !!(
|
|
||||||
process.env.SLACK_CLIENT_ID &&
|
|
||||||
process.env.SLACK_CLIENT_SECRET &&
|
|
||||||
process.env.SLACK_SIGNING_SECRET
|
|
||||||
),
|
|
||||||
category: "messaging",
|
category: "messaging",
|
||||||
imageSrc: "/apps/slack.svg",
|
imageSrc: "/apps/slack.svg",
|
||||||
logo: "/apps/slack.svg",
|
logo: "/apps/slack.svg",
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { stringify } from "querystring";
|
|||||||
|
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|
||||||
const client_id = process.env.SLACK_CLIENT_ID;
|
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
|
||||||
const client_secret = process.env.SLACK_CLIENT_SECRET;
|
|
||||||
|
let client_id = "";
|
||||||
|
let client_secret = "";
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
if (!req.session?.user?.id) {
|
if (!req.session?.user?.id) {
|
||||||
@@ -19,6 +21,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
res.redirect("/apps/installed"); // Redirect to where the user was if they cancel the signup or if the oauth fails
|
res.redirect("/apps/installed"); // Redirect to where the user was if they cancel the signup or if the oauth fails
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const appKeys = await getAppKeysFromSlug("slack");
|
||||||
|
if (typeof appKeys.client_id === "string") client_id = appKeys.client_id;
|
||||||
|
if (typeof appKeys.client_secret === "string") client_secret = appKeys.client_secret;
|
||||||
|
if (!client_id) return res.status(400).json({ message: "Slack client_id missing" });
|
||||||
|
if (!client_secret) return res.status(400).json({ message: "Slack client_secret missing" });
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
client_secret,
|
client_secret,
|
||||||
client_id,
|
client_id,
|
||||||
|
|||||||
Reference in new issue
Block a user