In order to install your app across multiple Slack workspaces, you will need to set up OAuth. If you're not familiar with OAuth, the basic explanation is that your app needs to go through a few steps to verify that it is allowed to access a workspace. The three steps are:
- Asking for scopes
- Waiting for a user to approve your requested scopes
- Exchanging a temporary authorization code for an access token
You may be familiar with this workflow without even knowing it - it's likely what occurs anytime you see a screen this like when trying to install something:
In order to set up OAuth on your Slack app, you will need to take a few steps:
- Go to your Slack app's Manage Distribution page and add an OAuth redirect URL:
This URL should be in the following format: The URL you provide will need to be in the following format: https://USERNAME-CANVASNAME.builtwithdark.com/oauth-redirect
Return to the main Manage Distribution page, copy the Sharable URL and then navigate to it. Follow the steps, making sure to finish with clicking Allow.
Go to your Dark canvas and look in your 404s list to find your
oauth-redirecthandler, complete with trace. Click the
+to add it to your canvas.
Create a new Datastore called
tokenStore, and add two
Return to your
oauth-redirecthandler and call the
Slack::oauthfunction. You will need your client ID and client secret, as well as the token store you created in the previous step. The final parameter is pulling the temporary code out of the request using
- Hit the play button for the function. If you get an error, repeat step 2. If everything goes as expected, an entry will be added to your datastore, and it will look locked.