File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
apps/sim/app/api/tools/gmail/label Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11import { db } from '@sim/db'
22import { account } from '@sim/db/schema'
33import { createLogger } from '@sim/logger'
4- import { and , eq } from 'drizzle-orm'
4+ import { eq } from 'drizzle-orm'
55import { type NextRequest , NextResponse } from 'next/server'
66import { getSession } from '@/lib/auth'
77import { 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
You can’t perform that action at this time.
0 commit comments