Browse Source

describe how to issue token correctly

Outsider 7 years ago
parent
commit
2be0c2d42b
6 changed files with 36 additions and 10 deletions
  1. 36 10
      README.md
  2. BIN
      screenshots/legacy-token.gif
  3. BIN
      screenshots/oauth1.gif
  4. BIN
      screenshots/oauth2.gif
  5. BIN
      screenshots/oauth3.gif
  6. BIN
      screenshots/oauth4.gif

+ 36 - 10
README.md

@@ -5,8 +5,7 @@ A tiny web application to invite a user into your Slack team.
 
 Inspired by
 [How I hacked Slack into a community platform with Typeform](https://levels.io/slack-typeform-auto-invite-sign-ups/)
-and
-Socket.io's Slack page.
+and Socket.io's Slack page.
 
 This project supports Heroku, Azure and Cloud Foundry.
 
@@ -23,10 +22,7 @@ Fill out `config.js` as your infomation.
 
 * `community`: your community or team name to display on join page.
 * `slackUrl` : your slack team url (ex.: socketio.slack.com)
-* `slacktoken` : Your access token for Slack.
-  - You can generate it in <https://api.slack.com/custom-integrations/legacy-tokens>.
-  - **You should generate the token in admin user, not owner.**
-  If you generate the token in owner user, a `missing_scope` error may occur.
+* `slacktoken` : Your access token for Slack. (see [Issue token](#issue-token))
 * `inviteToken`: An optional security measure - if it is set, then that token will be required to get invited.
 * `locale`: Application language (currently `cs`, `de`, `en`, `es`, `fr`, `it`,  `ja`, `ko`, `pl`, `pt`, `pt-BR`, `tr`, `zh-CN` and `zh-TW` available).
 
@@ -37,10 +33,7 @@ If you want to use a `.env` file, create a file in the root called `.env` with t
 
 - `COMMUNITY_NAME` : Your community or team name to display on join page.
 - `SLACK_URL` : Your Slack team url (ex.: socketio.slack.com)
-- `SLACK_TOKEN` : Your access token for Slack.
-  - You can generate it in <https://api.slack.com/web#auth>.
-  - **You should generate the token as an admin user, not owner.**
-  If you generate the token in owner user, a `missing_scope` error may occur.
+- `SLACK_TOKEN` : Your access token for Slack. (see [Issue token](#issue-token))
 - `INVITE_TOKEN`: An optional security measure - if it is set, then that token will be required to get invited.
 - `LOCALE`: Application language (currently `cs`, `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `pl`, `pt`, `pt-BR`, `tr`, `zh-CN` and `zh-TW` available).
 
@@ -90,3 +83,36 @@ $ cd slack-invite-automation
 $ docker build -t slack-invite-automation .
 $ docker run -it --rm -e COMMUNITY_NAME="YOUR-TEAM-NAME" -e SLACK_URL="YOUR-TEAM.slack.com" -e SLACK_TOKEN="YOUR-ACCESS-TOKEN" -p 3000:3000 slack-invite-automation
 ```
+
+## Issue token
+**You should generate the token in admin user, not owner.** If you generate the token in owner user, a `missing_scope` error may occur.
+
+There are two ways to issue the access token.
+
+### Legacy tokens
+1. Visit <https://api.slack.com/custom-integrations/legacy-tokens>.
+1. Click `Create token`.
+
+    ![](https://raw.github.com/outsideris/slack-invite-automation/master/screenshots/legacy-token.gif)
+
+### OAuth tokens
+1. Visit <https://api.slack.com/apps> and Create New App.
+
+    ![](https://raw.github.com/outsideris/slack-invite-automation/master/screenshots/oauth1.gif)
+
+1. Click "Permissions".
+
+    ![](https://raw.github.com/outsideris/slack-invite-automation/master/screenshots/oauth2.gif)
+
+1. In "OAuth & Permissions" page, select `admin` scope under "Permission Scopes" menu and save changes.
+
+    ![](https://raw.github.com/outsideris/slack-invite-automation/master/screenshots/oauth3.gif)
+
+1. Click "Install App to Team".
+
+    ![](https://raw.github.com/outsideris/slack-invite-automation/master/screenshots/oauth4.gif)
+
+1. Visit <https://slack.com/oauth/authorize?&client_id=CLIENT_ID&team=TEAM_ID&install_redirect=install-on-team&scope=admin+client> in your browser and authorize it.
+    * It authorizes the `client` permission. Otherwise, you can see `{"ok":false,"error":"missing_scope","needed":"client","provided":"admin"}` error.
+    * Your `CLIENT_ID` could be found in "Basic Information" menu of your app page that you just install.
+    * Your `TEAM_ID` could be found in <https://api.slack.com/methods/team.info/test>

BIN
screenshots/legacy-token.gif


BIN
screenshots/oauth1.gif


BIN
screenshots/oauth2.gif


BIN
screenshots/oauth3.gif


BIN
screenshots/oauth4.gif