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

After a user installs my Slack app I want to redirect them to my web app, hosted on a different domain #1703

Closed
4 of 10 tasks
MattB543 opened this issue Dec 29, 2022 · 5 comments
Labels
question M-T: User needs support to use the project

Comments

@MattB543
Copy link

Description

After a user installs my Slack app I want to redirect them to my web app which is hosted on a different domain, is that possible?

Currently, if I pass my Slack app installation domain as the redirect_uri everything works perfectly.

If I try to update the redirect_uri to be my front-end domain it properly redirects and displays no errors, yet it's not installing the app on the workspace anymore...

Is there something I'm missing in the bolt config?

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:
@slack/bolt": "3.11.1

node version:
v18.12.1

OS version(s):

Steps to reproduce:

  1. Set the redirectUri & redirectUriPath to a domain that isn't hosting the Slack app

Expected result:

The Slack app installs on the workspace and redirects to the domain I set as the redirectUri which is my web app front-end. The front end passes the state and code to the backend and signs the user directly into my web app.

Actual result:

The Slack app does not install on the workspace.

Attachments:

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

seratch commented Dec 30, 2022

Hi @MattB543, thanks for asking the question. You can use CallbackOptions.success for it. Refer to #1571 (comment) for more details. In your case, you can redirect an installing user to a different domain instead of rendering the webpage.

@themashcodee
Copy link

Hi, @seratch thanks for the reply.

Actually, we want our user to automatically log in to our application with slack OpenID authorization https://slack.com/openid/connect/authorize.

So in order to do that we need a code that OpenID authorization returns to the redirect URI, so how we can get it from the app installation?

@seratch
Copy link
Member

seratch commented Dec 30, 2022

@themashcodee An app installation into a Slack workspace is indeed an OAuth flow, but it's not compatible with OpenID Connect including the "Sign in with Slack" one. So, if you need an OpenID Connect response, the user needs to go through the Sign in with Slack flow separately. Also, unfortunately, bolt-js does not support Sign in with Slack. You need to add custom routes (or build a different app) for the Sign in with Slack flow. Refer to an example app directly using the underlying @slack/oauth package: https://github.com/slackapi/node-slack-sdk/tree/main/examples/openid-connect

Lastly, if the reason you're considering "Sign in with Slack" is to receive the installing user's identity, the app installation flow's oauth.access.v2 API response already provides it. If that's the case, you may not have to add the OpenID Connect flow to the app.

I hope this helps.

@themashcodee
Copy link

@seratch thank you so much for the help, I really appreciate it.

@MattB543
Copy link
Author

Thanks, @seratch , appreciate your quick response!

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

3 participants