-
Notifications
You must be signed in to change notification settings - Fork 430
[DRAFT] [WIP] Add in builtin listener for token revoked and app uninstalled events #2337
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
011fcd4
a6491ac
f4fa2d3
7f70036
6b549f0
d19f686
bf058dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { InstallationStore, InstallationQuery } from "@slack/oauth"; | ||
| import { Logger } from '@slack/logger'; | ||
| import { Context } from "../types"; | ||
|
|
||
| export class TokenRevocationListeners { | ||
| private installationStore: InstallationStore; | ||
| private logger: Logger; | ||
|
|
||
| public constructor(installationStore: InstallationStore, logger: Logger) { | ||
| this.installationStore = installationStore; | ||
| this.logger = logger; | ||
| } | ||
|
|
||
| public handleTokensRevokedEvents(context: Context) { | ||
| const isEnterpriseInstall = context.isEnterpriseInstall; | ||
|
|
||
| const installQuery: InstallationQuery<typeof isEnterpriseInstall> = { | ||
| isEnterpriseInstall: isEnterpriseInstall, | ||
| teamId: isEnterpriseInstall ? context.teamId : undefined, | ||
| enterpriseId: isEnterpriseInstall ? context.enterpriseId : undefined | ||
| }; | ||
|
|
||
| this.installationStore.deleteInstallation(installQuery, this.logger); | ||
|
|
||
| // add logic to delete bot? | ||
|
||
| } | ||
|
|
||
| public handleAppUninstalledEvents(context: Context) { | ||
| const isEnterpriseInstall = context.isEnterpriseInstall; | ||
|
|
||
| const installQuery: InstallationQuery<typeof isEnterpriseInstall> = { | ||
| isEnterpriseInstall: isEnterpriseInstall, | ||
| teamId: isEnterpriseInstall ? context.teamId : undefined, | ||
| enterpriseId: isEnterpriseInstall ? context.enterpriseId : undefined | ||
| }; | ||
|
|
||
| this.installationStore.deleteInstallation(installQuery, this.logger); | ||
|
|
||
| // add logic to delete bot? | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.