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

Error when using app in another workspace #494

Closed
4 of 9 tasks
T-Roth opened this issue May 7, 2020 · 7 comments
Closed
4 of 9 tasks

Error when using app in another workspace #494

T-Roth opened this issue May 7, 2020 · 7 comments
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info question M-T: User needs support to use the project

Comments

@T-Roth
Copy link

T-Roth commented May 7, 2020

I created a 2nd workspace to test deploying my app. I enabled public distribution, but didn't go through the entire submit process. When I run the oAuth flow to install the app I can pick my 2nd workspace and the app seems to install with a warning that it hasn't been reviewed. When I try to interact with the app I get a 'invalid user_id error

Is the problem that the app hasn't been submitted for review? Or do I need to do something different when installing the app to another workspace?

image

Sorry if this is the wrong place to ask this question.

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

  • bug
  • enhancement (feature request)
  • question
  • documentation 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.

@seratch seratch added question M-T: User needs support to use the project needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info labels May 7, 2020
@seratch
Copy link
Member

seratch commented May 7, 2020

We really need more info to help you here.

I get a 'invalid user_id error

For what API calls?

I'm not sure where you're now but generally speaking, a Slack app that is available for multiple workspaces should have its own database to store bot/user tokens per workspace. Picking up the right token for an incoming request by implementing authorize function is necessary in the case. Also, as you may be already aware, it'll be much easier with upcoming OAuth support in Bolt for JS.

@T-Roth
Copy link
Author

T-Roth commented May 7, 2020

@seratch everything is currently in memory and since I'm running the app locally there is no state for either of my workspaces. In the app_home_opened event I'm calling
app.client.views.publish({token, user_id: slackUserId, view: new WelcomeView().getView() });
which seems to be the source of the error. I'm not calling authorize for the original workspace where I created the app and everything is working within that workspace.

@seratch
Copy link
Member

seratch commented May 7, 2020

Your app needs to have authorize. If you're already using @slack/oauth, the InstallProvider provides the function. Simply using it should work for you. Checking #479 is helpful to know how to do it.

@T-Roth
Copy link
Author

T-Roth commented May 7, 2020

@seratch I implemented the authorize function using the InstallProvider. I see it calling authorize, but the end result is the same error of invalid user_id. I have it setup to use a DB backed InstallationStore.

This is the InstallQuery passed to authorize
image

The result from authorize
image

Debug output
image

@T-Roth
Copy link
Author

T-Roth commented May 7, 2020

Found my problem, I was still passing my original botToken from my .env file and not the new botToken from the workspace where the app was installed. I didn't understand that each workspace gets a different botToken for the same app

@T-Roth T-Roth closed this as completed May 7, 2020
@seratch
Copy link
Member

seratch commented May 7, 2020

Good to know you've figured out the cause!

@ubaidchawla
Copy link

Found my problem, I was still passing my original botToken from my .env file and not the new botToken from the workspace where the app was installed. I didn't understand that each workspace gets a different botToken for the same app

Hi, can you please tell me how to get the new botToken from workspace where the app was installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

3 participants