DEV Community

Cover image for OAuth with slack
Nikhil Devarasetty
Nikhil Devarasetty

Posted on

OAuth with slack

🤔 What is OAuth? 👇
OAuth is a protocol that lets your app request authorization to private details.

With slack we can implement OAuth for the required scopes, to access the workspace channels, members, conversations, calls, listen to events, etc...

Ohh, 🤔 What are scopes then? 👇
Scopes are used to grant your app permission to perform functionality in Slack like,

  1. Call Web API methods, users.list,, channels.write, etc...
  2. Receive Events API events like, user joined, channel created, etc...

Then how to do it? 👉 Follow the below steps

Create and Install app to workspace:

  1. Create slack workspace, by going to
  2. After that, create an app, by going to, choosing respective workspace.
  3. After creating app, go to the created app and under OAuth & permissions section give the required scopes.
  4. After giving scopes you can able to install app to your workspace or publish it to slack open directory.

Performing OAuth

  1. To perform OAuth we need to generate authorization redirect url, to do so navigate to
  2. The url will look like,

    GET /openid/connect/authorize?
  3. The redirect_uri in above url, is the request handler for which slack to redirect with temporary access code.

  4. With that temporary access code we need to request for access-token using api{access_code}&client_id=###&client_secret=###&redirect_uri=###, for more details about api method, headers and parameter look into

  5. With the access-token received, you can store it securely and use it whenever required.

Hurray! It's done 😇


  • I have provided basic walkthrough, please do explore, for detailed explanation.
  • And explore the Refresh token concept, how to opt for it, refresh the access-token using refresh token.

Top comments (0)