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 [ ])
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.
In the OAuth flow support, the installation URL
/slack/installdisplays a web page with an installation button. If a developer would like to use the/slack/installas 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/installURL.I propose adding a new option named
install_page_rendering_enabled: bool = TruetoOAuthSettingsandAsyncOAuthSettings. The default isTrue, which is backward-compatible.Implementation
A possible implementation using the new option should look like this:
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
xin each of the[ ])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.