我试图使用节点API从slack中获取一些对话历史记录,目前我在权限方面有点困难。要阅读私人频道等,我相信我需要向
X-Slack-Use
.但在我这么做之前,我需要让用户对应用程序进行身份验证。
我创造了一个新的
斜线
命令
/digest
这对我的申请提出了要求。然后,我需要发出以下命令以请求权限:
const response = await this.slackWebClient.apps.permissions.request({
token: ...,
scopes: ["channels:history", "channels:read", "groups:history", "groups:read", "im:read"],
trigger_id: triggerID,
user: userID,
});
我想我的困难在于拿到正确的代币。传入的请求有一个令牌:
[Object: null prototype] {
token: 'yM....R',
team_id: 'TD.....E',
team_domain: '...',
channel_id: 'CF.....B',
channel_name: 'email_digest_test',
user_id: 'UD.....Y',
user_name: 'Ian',
command: '/digest',
text: '',
response_url: 'https://hooks.slack.com/commands/TD.....E/55....62/cw....Eq',
trigger_id: '553.....45......6.bb.............719' }
但是,如果我尝试使用此选项,我会得到一个错误:
代码:
slackclient_platform_error
,错误:
invalid_auth
如果我试图使用我的应用程序OAuth令牌
xoxp-45.........................
然后我得到一个
代码:
slackclient_平台_错误
,错误:
not_allowed_token_type
有人能看出我在这里做错了什么吗?