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

When is deleteInstallation called? #1628

Closed
1 of 7 tasks
acerbisgianluca opened this issue Jun 9, 2023 · 2 comments
Closed
1 of 7 tasks

When is deleteInstallation called? #1628

acerbisgianluca opened this issue Jun 9, 2023 · 2 comments
Labels
pkg:oauth applies to `@slack/oauth-helper` question M-T: User needs support to use the project

Comments

@acerbisgianluca
Copy link

Hey there, I was looking at the source code and I couldn't find where deleteInstallation is being called. Should I call it manually?

I'm building an app the requires account linking for a third party service. What I'm doing now is:

  • when the user types /xx login, I send a button which opens an URL on my backend
  • the backend uses installer.handleInstallPath(...) to redirect the user to the Slack consent page
  • once the user gives the consent and lands back to the callback url, I redirect the user to the third party login page
  • once the user logs in and lands back to the callback url, I redirect him to Slack app home
  • at this point I'm sure that the user granted the permissions to the Slack app and that I've access to the third party service

Now, if the user revokes the consent to the Slack app, when is deleteInstallation being called? Should I listen to the tokens_revoked event and call deleteInstallation manually?

If you have any suggestion for the flow above, feel free to comment,
Thanks!

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • @slack/types
  • I don't know

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

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 question M-T: User needs support to use the project pkg:oauth applies to `@slack/oauth-helper` and removed untriaged labels Jun 12, 2023
@seratch
Copy link
Member

seratch commented Jun 12, 2023

Hi @acerbisgianluca, thanks for writing in!

I was looking at the source code and I couldn't find where deleteInstallation is being called. Should I call it manually?

The method is supposed to be called when receiving the following events:

Your app can subscribe these events to maintain installation data. If you're using bolt-js too, the framework may add built-in listeners for the above event handling. Check slackapi/bolt-js#1203 for the progress.

An alternative approach is to perform regular validations on the tokens stored in your database by utilizing https://api.slack.com/methods/auth.test API. If a token receives an error in response to the API call, the token might be revoked for some reason. You can safely delete the data for safety.

I hope this helps.

@acerbisgianluca
Copy link
Author

Thanks for your hints @seratch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:oauth applies to `@slack/oauth-helper` question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants