fix: lark calendar get app access token bug (#4043)

Co-authored-by: chengcheng.frontend <chengcheng.frontend@bytedance.com>
pull/4034/head
Cheng CHENG 2022-08-31 01:08:29 +08:00 committed by GitHub
parent fe12a83898
commit ad8d0a4e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -55,7 +55,8 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
// used for events handler binding in lark open platform, see
// https://open.larksuite.com/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM?lang=en-US
if (req.body.type === "url_verification") {
if (req.body.type === "url_verification" && req.body.token === open_verification_token) {
log.debug("update token", req.body);
return res.status(200).json({ challenge: req.body.challenge });
}

View File

@ -32,6 +32,10 @@ function makePoolingPromise<T>(
const appKeysSchema = z.object({
app_id: z.string().min(1),
app_secret: z.string().min(1),
app_access_token: z.string().optional(),
app_ticket: z.string().optional(),
expire_date: z.number().optional(),
open_verification_token: z.string().min(1),
});
const getValidAppKeys = async (): Promise<ReturnType<typeof getAppKeys>> => {