Skip to content

Easier way to configure the installation URL as the direct install URL on App Directory #183

Description

@seratch

In the OAuth flow support, the installation URL /slack/install displays a web page with an installation button. If a developer would like to use the /slack/install as the URL for direct install URL on App Directory listing page, end-users have to click button twice. Bolt can provide an option to easily change the handler for /slack/install URL.

I propose adding a new option named install_page_rendering_enabled: bool = True to OAuthSettings and AsyncOAuthSettings. The default is True, which is backward-compatible.

Implementation

A possible implementation using the new option should look like this:

def handle_installation(self, request: BoltRequest) -> BoltResponse:
    state = self.issue_new_state(request)
    url = self.build_authorize_url(state, request)
    set_cookie_value = self.settings.state_utils.build_set_cookie_for_new_state(state)
    if self.settings.install_page_rendering_enabled:
        html = self.build_install_page_html(url, request)
        return BoltResponse(
            status=200,
            body=html,
            headers={
                "Content-Type": "text/html; charset=utf-8",
                "Content-Length": len(bytes(html, "utf-8")),
                "Set-Cookie": [set_cookie_value],
            },
        )
    else:
        return BoltResponse(
            status=302,
            body="",
            headers={
                "Content-Type": "text/html; charset=utf-8",
                "Location": url,
                "Set-Cookie": [set_cookie_value],
            },
        )

Other Bolt frameworks

Bolt for JS

It does not provide a way to customize the behavior yet. Developers needs to create a yet another endpoint to immediately redirect users to the Slack authorize URL by directly using installer.generateInstallUrl.

https://github.com/slackapi/bolt-js/blob/%40slack/bolt%402.5.0/src/ExpressReceiver.ts#L122-L137

Bolt for Java

It already has the AppConfig#oAuthInstallPageRenderingEnabled (default: true) option.

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

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Others

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions