Skip to content

Commit ea401e4

Browse files
committed
fix(drive): use checkSessionOrInternalAuth to allow browser access
1 parent c8fc0ac commit ea401e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/sim/app/api/tools/drive/file/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { authorizeCredentialUse } from '@/lib/auth/credential-access'
4-
import { checkInternalAuth } from '@/lib/auth/hybrid'
4+
import { checkSessionOrInternalAuth } from '@/lib/auth/hybrid'
55
import { validateAlphanumericId } from '@/lib/core/security/input-validation'
66
import { generateRequestId } from '@/lib/core/utils/request'
77
import { refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
@@ -16,7 +16,7 @@ export async function GET(request: NextRequest) {
1616
const requestId = generateRequestId()
1717
logger.info(`[${requestId}] Google Drive file request received`)
1818

19-
const auth = await checkInternalAuth(request)
19+
const auth = await checkSessionOrInternalAuth(request)
2020
if (!auth.success || !auth.userId) {
2121
return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 })
2222
}

apps/sim/app/api/tools/drive/files/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { authorizeCredentialUse } from '@/lib/auth/credential-access'
4-
import { checkInternalAuth } from '@/lib/auth/hybrid'
4+
import { checkSessionOrInternalAuth } from '@/lib/auth/hybrid'
55
import { validateAlphanumericId } from '@/lib/core/security/input-validation'
66
import { generateRequestId } from '@/lib/core/utils/request'
77
import { refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
@@ -73,7 +73,7 @@ export async function GET(request: NextRequest) {
7373
const requestId = generateRequestId()
7474
logger.info(`[${requestId}] Google Drive files request received`)
7575

76-
const auth = await checkInternalAuth(request)
76+
const auth = await checkSessionOrInternalAuth(request)
7777
if (!auth.success || !auth.userId) {
7878
return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 })
7979
}

0 commit comments

Comments
 (0)