首页 文章

Slack Oauth /授权API调用

提问于
浏览
1

我'm new to OAuth (and the Slack API) and have a question regarding Step 1 of Slack' s OAuth Flow .

它说“您的网络或移动应用程序应将用户重定向到以下网址:https://slack.com/oauth/authorize” . 起初我以为我应该做一个XHR请求但后来才明白这不是我想要的 .

经过更多的研究,我发现初始的oauth / authorize请求应该作为直接请求在浏览器中发送 . 我的问题是我可以't begin to visualize how this should be done. I'引用了这个tutorial的部分内容(向下滚动到'Web Server Apps'部分),但它无法帮助我绕过oauth / authorize请求 .

所以基本上,我正在寻找一个能够更好地向我解释应该如何进行最初请愿的人 . 非常感谢任何和所有的帮助!

提前致谢

1 回答

  • 1

    你应该看看Slack button docs .

    你会在那里找到一个slackapp的例子,例如:

    <a href="https://slack.com/oauth/authorize?scope=incoming-webhook&client_id=CLIENT_ID">
       <img alt="Add to Slack" height="40" width="139" 
       src="https://platform.slack-edge.com/img/add_to_slack.png" />
    </a>
    

    此按钮要求授权包含传入webhook的slackapp,您可以在范围内添加所需的更多功能,用逗号分隔它们 . scope=incoming-webhook,commands,bot,channels:read

    从教程链接开始,当它说你应该将它们链接到 https://oauth2server.com/auth?response_type=code&client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&scope=photos

    它指的是将其包装到用户的按钮中:

    <a href="https://oauth2server.com/auth?response_type=code&client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&scope=photos">
       Auth Button
    </a>
    

    希望这有助于澄清 /oauth/authorize 的用法

相关问题