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

Collect credentials from the end user when creating a new issue #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $ slack create my-github-app -t slack-samples/deno-github-functions
$ cd my-github-app
```

### Register a GitHub App
### Register an OAuth App on GitHub
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing a broken link in the table of contents!


With [external authentication](https://api.slack.com/future/external-auth) you
can connect your GitHub account to your Slack app to easily access the GitHub
Expand Down Expand Up @@ -111,25 +111,15 @@ the app locally.
#### Initiate the OAuth2 Flow

With your GitHub OAuth application created and the Client ID and secret set,
you're ready to initate the OAuth flow!
you're just about ready to initate the OAuth flow!

If all the right values are in place, then the following command will prompt you
to choose an app, select a provider (hint: choose the `github` one), then pick
the GitHub account you want to authenticate with:
The "Create New Issue" workflow collects credentials using the
[end user tokens](https://api.slack.com/automation/external-auth#workflow__using-end-user-tokens)
that are gathered when this workflow is invoked. This prompts the person running
the workflow to authenticate with GitHub and then performs actions as the
authenticated account.

```zsh
$ slack external-auth add
```

After you've added your authentication, you'll need to assign it to the
`#/workflows/create_new_issue_workflow` workflow using the following command:

```zsh
$ slack external-auth select-auth
```

Once you've successfully connected your account, you're almost ready to create a
link into your workflow!
Keep reading on to create a link into this workflow and to connect your account!

#### Collaborating with External Authentication

Expand Down Expand Up @@ -199,8 +189,8 @@ Connected, awaiting events

Once running, click the
[previously created Shortcut URL](#create-a-link-trigger) associated with the
`(local)` version of your app. This should start a workflow that opens a form
used to create a new GitHub issue!
`(local)` version of your app. This should start a workflow that opens a form to
connect your GitHub account and create a new issue!

To stop running locally, press `<CTRL> + C` to end the process.

Expand Down
2 changes: 1 addition & 1 deletion workflows/create_new_issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const issue = CreateNewIssueWorkflow.addStep(CreateIssueDefinition, {
* Learn more: https://api.slack.com/automation/external-auth#workflow
*/
githubAccessTokenId: {
credential_source: "DEVELOPER",
credential_source: "END_USER",
},
url: issueFormData.outputs.fields.url,
title: issueFormData.outputs.fields.title,
Expand Down