我正在尝试获取 Slack 中的私人频道列表(基于每个用户即可),但我在查看此信息时遇到问题。我最初将应用程序安装到 Slack 中的工作区中,并获得了表单中的 OAuth 令牌xoxp-4...........
.
应用程序 OAuth 令牌
当我尝试使用 slack API(节点 SDK)时,我只能获得公开列出的频道。
await new WebClient(`xoxp-4.....`)
.conversations
.list({ exclude_archived: true })
).channels
如果我尝试使用 Slack API 测试器来获取相同的结果,我也会得到同样的结果频道列表 https://api.slack.com/methods/channels.list/test.
用户 OAuth 令牌
我已经按照OAuth 2.0 https://api.slack.com/docs/oauth为给定用户(我自己)获取令牌的过程。我认为我已经正确完成了这一切(这是回复):
{
ok: true,
access_token: 'xoxp-4.........',
scope: 'identify,bot,commands,channels:history,groups:history,im:history,mpim:history,channels:read,emoji:read,groups:read,im:read,search:read,team:read,users:read,users:read.email,usergroups:read,users.profile:read,chat:write:user,chat:write:bot,links:read',
user_id: 'UD......',
team_name: '............',
team_id: '.......',
scopes: ['identify',
'bot',
'commands',
'channels:history',
'groups:history',
'im:history',
'mpim:history',
'channels:read',
'emoji:read',
'groups:read',
'im:read',
'search:read',
'team:read',
'users:read',
'users:read.email',
'usergroups:read',
'users.profile:read',
'chat:write:user',
'chat:write:bot',
'links:read'
]
}
有趣的是,我发现如果我进入应用程序管理,这会为我提供完全相同的 OAuth 令牌(我假设是因为是我将应用程序安装到工作区的)。
显然,因为它是相同的令牌,所以我仍然没有获得查看私人频道的权限,即使据我所知,我应该能够做作为用户可以做的一切?
谁能指出我可能缺少什么?