首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Bolt验证Slash命令

用Bolt验证Slash命令
EN

Stack Overflow用户
提问于 2021-08-22 16:04:36
回答 1查看 315关注 0票数 2

我目前正在使用BoltJS编写一个secret,并希望使用综合验证()方法添加验证,这需要签名秘密以及传入的请求。问题是,触发app.command()方法的命令不能提供整个请求。它只提供了有效负载,因此verify()方法引发以下错误:

代码语言:javascript
复制
TypeError: stream.on is not a function

因为所提供的参数没有一个是有效的。

代码语言:javascript
复制
//These are the parameters of the app.command method

export interface SlackCommandMiddlewareArgs {
    payload: SlashCommand;
    command: this['payload'];
    body: this['payload'];
    say: SayFn;
    respond: RespondFn;
    ack: AckFn<string | RespondArguments>;
}

//This is what the SlashCommand Object is made of for context

export interface SlashCommand extends StringIndexed {
    token: string;
    command: string;
    text: string;
    response_url: string;
    trigger_id: string;
    user_id: string;
    user_name: string;
    team_id: string;
    team_domain: string;
    channel_id: string;
    channel_name: string;
    api_app_id: string;
    enterprise_id?: string;
    enterprise_name?: string;
    is_enterprise_install?: string;
}

在命令处理程序接收到请求之前,是否有任何方法可以对请求进行验证,或者是否完全丢失了其他内容?我在文档中没有发现任何关于这个的东西,但我会继续查找的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-24 03:44:21

来自slack的文件指出:

一些SDK自动执行签名验证,可以通过简单的插入替换旧验证令牌的签名秘密来访问。有关更多细节,请参见SDK支持部分。https://api.slack.com/authentication/verifying-requests-from-slack#about

Bolt for JS支持的SDK之一。

sdk-支持

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68883008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档