我目前正在使用BoltJS编写一个secret,并希望使用综合验证()方法添加验证,这需要签名秘密以及传入的请求。问题是,触发app.command()方法的命令不能提供整个请求。它只提供了有效负载,因此verify()方法引发以下错误:
TypeError: stream.on is not a function因为所提供的参数没有一个是有效的。
//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;
}在命令处理程序接收到请求之前,是否有任何方法可以对请求进行验证,或者是否完全丢失了其他内容?我在文档中没有发现任何关于这个的东西,但我会继续查找的。
发布于 2021-08-24 03:44:21
来自slack的文件指出:
一些SDK自动执行签名验证,可以通过简单的插入替换旧验证令牌的签名秘密来访问。有关更多细节,请参见SDK支持部分。https://api.slack.com/authentication/verifying-requests-from-slack#about
Bolt for JS是支持的SDK之一。
https://stackoverflow.com/questions/68883008
复制相似问题