From 1e361228f2542e662eeb2b8955905eaa796b93c3 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Thu, 7 Sep 2023 17:19:44 -0700 Subject: [PATCH 1/2] collect credentials from the end user instead of developer --- README.md | 28 +++++++++------------------- workflows/create_new_issue.ts | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 11f4193..450e356 100644 --- a/README.md +++ b/README.md @@ -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 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 @@ -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 @@ -200,7 +190,7 @@ 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! +to connect your GitHub account and create a new issue! To stop running locally, press ` + C` to end the process. diff --git a/workflows/create_new_issue.ts b/workflows/create_new_issue.ts index 83afe6e..37c86af 100644 --- a/workflows/create_new_issue.ts +++ b/workflows/create_new_issue.ts @@ -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, From ef6e025f82367163f0bf554840d5ae2c5a35ddb4 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Thu, 7 Sep 2023 17:25:30 -0700 Subject: [PATCH 2/2] fmt: adjust formatting according to the deno fmt check --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 450e356..4d9c16b 100644 --- a/README.md +++ b/README.md @@ -189,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 -to connect your GitHub account and create a new 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 ` + C` to end the process.