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

Installation Options on api.slack.com 'Manage Distribution' don't work #1284

Closed
4 of 10 tasks
brianjychan opened this issue Jan 23, 2022 · 6 comments
Closed
4 of 10 tasks
Labels
question M-T: User needs support to use the project

Comments

@brianjychan
Copy link

brianjychan commented Jan 23, 2022

Description

Both the Embeddable Slack Button and Shareable URL do not work. It results in a page saying:

"""
(App Name) could not be installed.

It looks like something has gone awry. Don’t worry it’s not your fault, but you won’t be able to install (App Name) at the moment.

Error details
Invalid permissions requested
invalid_scope
"""

What's the reason for this? I am using the Bolt framework with a custom receiver, and the /slack/install path works fine. I'm aiming to provide an install button on my React frontend. What fix or workaround do you advise?

Thank you!

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: 3.4.0

node version: 15.12

OS version(s): Mac OSX

Steps to reproduce:

  1. Log into api.slack.com
  2. Manage Distribution
  3. Try any of the options

Expected result:

Successful installation

Actual result:

Error as described above

@brianjychan brianjychan changed the title Installation Options on app.slack.com 'Manage Distribution' don't work Installation Options on api.slack.com 'Manage Distribution' don't work Jan 23, 2022
@brianjychan
Copy link
Author

Update: it appears removing chat:write under User Token Scopes fixes the above issue, enabling the standard Installation page with "Cancel / Allow", but there is still another problem.

Upon choosing Allow, the app returns:

"Oops, Something Went Wrong! Please Try Again or Contact the App Owner"

Logs show OAuth:InstallProvider:0 Error: redirect url is missing state or code query parameters. What's the recommended way to handle this with Bolt?

@seratch seratch added the question M-T: User needs support to use the project label Jan 23, 2022
@seratch
Copy link
Member

seratch commented Jan 23, 2022

Hi @brianjychan, can you check https://slack.dev/bolt-js/concepts#authenticating-oauth ?

Bolt for JavaScript provides an Install Path /slack/install out-of-the-box. This returns a simple Add to Slack button where users can initiate direct installs of your app.

This means that, instead using the generated slack.com URL in your Slack app configuration page, you can use https://{your app host}/slack/install for starting the OAuth flow. With this way, your authorize URL can have a valid state parameter in the /slack/oauth_redirect query string.

If you want to embed /slack/install URL in your own "Add to Slack" button (=skipping the page rendering by bolt-js), you can set directInstall option to your App initialization:

const app = new App({
  signingSecret: process.env.SLACK_SIGNING_SECRET,
  clientId: process.env.SLACK_CLIENT_ID,
  clientSecret: process.env.SLACK_CLIENT_SECRET,
  scopes: ['chat:write', 'commands'],
  installerOptions: {
    directInstall: true,
  }
});

I hope this helps!

@brianjychan
Copy link
Author

Hi @seratch, thanks for the help.

Where is the directInstall option documented? Searching the bolt docs and @slack/bolt package yields no results. My TS linter also reports:

Type '{ directInstall: true; }' is not assignable to type 'HTTPReceiverInstallerOptions'.
  Object literal may only specify known properties, and 'directInstall' does not exist in type 'HTTPReceiverInstallerOptions'.ts(2322)

I also used // @ts-ignore, but upon running the code, nothing changed, and /slack/install still served the page rendering that contains the "Add to Slack" button.

@seratch
Copy link
Member

seratch commented Jan 25, 2022

@brianjychan The option was added in v3.7: #977 but you're using v3.4. Can you upgrade to the latest (v3.9)? The documents are not great enough. We'll improve it in the future.

@brianjychan
Copy link
Author

brianjychan commented Jan 26, 2022 via email

@seratch
Copy link
Member

seratch commented Jan 27, 2022

Sorry for the confusion due to the documents. We'll improve it soon! Let us close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants