如何自动从Slack获取访问令牌? [英] How can I automate getting an access token from Slack?

查看:133
本文介绍了如何自动从Slack获取访问令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Apigee上建立一个警报系统,该系统会自动将警报发送到Slack,而无需人工干预.

I want to make an alert system on Apigee that will automatically send alerts to Slack, without the need for human interference.

但是,我在其api网站上发现的针对Slack的唯一OAuth流程似乎要求用户手动输入其凭据:

However, the only OAuth flow for Slack I found on their api site seems to require a user to manually input their credentials: https://api.slack.com/docs/oauth

如何自动从Slack获取访问令牌,而无需手动输入凭据?

How can I automate getting an access token from Slack, so without having to manually input credentials?

推荐答案

我认为您可能误解了Oauth的概念.它的工作方式是,每个Slack团队仅运行一次该流程(通常是在将Slack应用安装到Slack团队时),然后存储收到的访问令牌以备将来参考(例如在数据库中).因此,只要您的Slack应用在安装后需要访问令牌,便可以随时重用安装期间收到的令牌.

I think you may have misunderstood the concept of Oauth. The way it is supposed to work is, that you run the process only once per Slack team (usually while installing the Slack app to your Slack team) and then store the access token you received for future reference (e.g. in a database). So whenever your Slack app needs the access token after installation it can always reuse the one it received during installation.

如果您不需要运行任何脚本来进行安装,而只需要访问令牌,则还可以直接从Slack(在您的应用程序"下)安装Slack应用程序,然后将生成的访问令牌复制并粘贴到您的应用配置.查看文档以获取更多信息.

If you don't require any scripts to run for installation and you only need the access token you can also install your Slack app directly from Slack (under "Your Apps") and then copy and paste the resulting access token to your app configuration. Check this documentation for further information.

这篇关于如何自动从Slack获取访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆