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

Redirect after Request to Install submission for Slack App #1081

Closed
kennym opened this issue May 13, 2024 · 1 comment
Closed

Redirect after Request to Install submission for Slack App #1081

kennym opened this issue May 13, 2024 · 1 comment
Labels
question Further information is requested

Comments

@kennym
Copy link

kennym commented May 13, 2024

After a Slack user submits a Slack app for review to install to the Slack workspace admins, that user gets redirected to the Slack App Directory page, instead of the specified redirect_uri in the OAuthSettings.

How can we fix that?

Reproducible in:

django-slack==5.19.0
slack-bolt==1.18.1
slack-sdk==3.26.1
Python 3.11.6
ProductName:            macOS
ProductVersion:         14.4.1
BuildVersion:           23E224
Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000

The slack_bolt version

slack-bolt==1.18.1

Python runtime version

Python 3.11.6

OS info

ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., setup.py))

Slack OAuth configuration in our backend:

class SlackOAuthHandlerAPI(APIView):
    """API to handle slack oauth"""

    def get(self, request: HttpRequest) -> HttpResponse:
        """HTTP GET method"""
        success_url = f"{settings.FRONTEND_BASE_URI}/admin?slack_installation=success"
        failure_url = f"{settings.FRONTEND_BASE_URI}/auth/login"
        app = App(
            signing_secret=signing_secret,
            logger=log,
            oauth_settings=OAuthSettings(
                success_url=success_url,
                failure_url=failure_url,
                install_page_rendering_enabled=False,
                install_path="/api/oauth/slack/install/",
                redirect_uri_path="/api/oauth/slack/oauth_redirect/",
                client_id=client_id,
                client_secret=client_secret,
                scopes=scopes,
                user_scopes=user_scopes,
                # If you want to test token rotation, enabling the following line will
                # make it easy:
                # token_rotation_expiration_minutes=1000000,
                installation_store=DjangoInstallationStore(
                    client_id=client_id,
                    logger=log,
                ),
                state_store=DjangoOAuthStateStore(
                    expiration_seconds=120,
                    logger=log,
                ),
            ),
        )

        handler = SlackRequestHandler(
            app=app,
        )

        return handler.handle(request)
  1. Configure a Slack workspace to require admin approval for installing a Slack app
  2. Visit the App installation page: install-page.ngrok.app/api/oauth/slack/install/
    image
  3. Press "Submit"

Expected result:

Use the specific redirect_uri_path for redirecting the user.

Actual result:

User gets navigated to the Slack App Directory page for the Slack app.

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.

@seratch seratch added the question Further information is requested label May 17, 2024
@seratch
Copy link
Member

seratch commented May 17, 2024

Hi @kennym, thanks for submitting this question, and we're sorry about our slow response here.

Unfortunately, there is no way to customize the behavior in this scenario. We can bring your feedback internally to the product management team, but I cannot tell whether and when some enhancement will come for this use case.

I understand this is not a satisfactory answer, but I hope this helps clarify.

@seratch seratch closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants