Skip to content

Commit 0d019dc

Browse files
committed
fix(slack): only parse scoped user id for oauth credentials
1 parent 7e0c77c commit 0d019dc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • apps/sim/app/api/tools/slack/channels

apps/sim/app/api/tools/slack/channels/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
9393
accessToken = resolvedToken
9494
logger.info('Using OAuth token for Slack API')
9595

96-
if (authz.resolvedCredentialId) {
96+
// resolvedCredentialId is an account.id only for OAuth credentials; the
97+
// service_account path returns a credential.id, which must not be used as
98+
// an account lookup key. Slack never uses service accounts, but guard
99+
// explicitly so the lookup is correct by construction.
100+
if (authz.credentialType === 'oauth' && authz.resolvedCredentialId) {
97101
const [accountRow] = await db
98102
.select({ accountId: account.accountId })
99103
.from(account)

0 commit comments

Comments
 (0)