Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OAuth exchange capability #104

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add OAuth exchange capability #104

wants to merge 7 commits into from

Conversation

yasunariw
Copy link
Collaborator

@yasunariw yasunariw commented Dec 31, 2020

Description of the task

Add OAuth exchange functionality to the bot server, to allow distribution of the app.

For a single-workspace use case, the Slack access token used in #94 can be obtained manually through the app dashboard. But if there is a need to distribute monorobot to multiple users who don't have access to the app or its credentials, the server must be able to engage in an OAuth exchange.

This PR exposes an endpoint /slack/oauth, which Slack will query when a user initiates the OAuth workflow by authorizing the app to access their workspace.

For more information, refer to the comments for process_slack_oauth in file lib/action.ml.

How to test

In addition to the slack payload tests, new tests have been defined in slack_oauth_test.ml for the oauth exchange.

make test

References

This exposes a `/slack/oauth` route that Slack can query to trigger an
OAuth exchange, culminating in the generation of an access token
authorizing the bot to post messages to a workspace.

When just working with one bot app per workspace, the token can be
generated from the app dashboard and copy-pasted into the secrets file.
But if the app is distributed, and a user who isn’t a bot server admin
wants to install the bot into their workspace, the server needs to
handle OAuth.
If access token is provided in secrets file at startup time, should
copy into runtime state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant