Skip to content

Commit 032df8b

Browse files
committed
fix route to not block ws creds"
1 parent f494475 commit 032df8b

File tree

1 file changed

+5
-5
lines changed
  • apps/sim/app/api/tools/gmail/label

1 file changed

+5
-5
lines changed

apps/sim/app/api/tools/gmail/label/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { db } from '@sim/db'
22
import { account } from '@sim/db/schema'
33
import { createLogger } from '@sim/logger'
4-
import { and, eq } from 'drizzle-orm'
4+
import { eq } from 'drizzle-orm'
55
import { type NextRequest, NextResponse } from 'next/server'
66
import { getSession } from '@/lib/auth'
77
import { validateAlphanumericId } from '@/lib/core/security/input-validation'
@@ -49,23 +49,23 @@ export async function GET(request: NextRequest) {
4949
const credentials = await db
5050
.select()
5151
.from(account)
52-
.where(and(eq(account.id, resolved.accountId), eq(account.userId, session.user.id)))
52+
.where(eq(account.id, resolved.accountId))
5353
.limit(1)
5454

5555
if (!credentials.length) {
5656
logger.warn(`[${requestId}] Credential not found`)
5757
return NextResponse.json({ error: 'Credential not found' }, { status: 404 })
5858
}
5959

60-
const credential = credentials[0]
60+
const accountRow = credentials[0]
6161

6262
logger.info(
63-
`[${requestId}] Using credential: ${credential.id}, provider: ${credential.providerId}`
63+
`[${requestId}] Using credential: ${accountRow.id}, provider: ${accountRow.providerId}`
6464
)
6565

6666
const accessToken = await refreshAccessTokenIfNeeded(
6767
resolved.accountId,
68-
session.user.id,
68+
accountRow.userId,
6969
requestId
7070
)
7171

0 commit comments

Comments
 (0)