apply feedback

This commit is contained in:
Prakash 2026-05-22 21:59:05 +05:30
parent 2321e221b8
commit 272b199dc9

View file

@ -1,4 +1,5 @@
import type { Request, Response } from 'express'
import logger from '../logger.js'
/**
* Returns the decrypted Dropbox OAuth tokens for the current session.
@ -12,9 +13,12 @@ export default function bridgeTokens(req: Request, res: Response): void {
// provider cannot be read here: `verifyToken` decrypts against this same param,
// so a mismatched path is rejected by the middleware before reaching this point.
if (req.params['providerName'] !== 'dropbox') {
res
.status(400)
.json({ error: 'The bridge-tokens endpoint only supports Dropbox.' })
logger.warn(
`bridge-tokens called for unsupported provider: ${req.params['providerName']}`,
'bridge-tokens',
req.id,
)
res.status(400).end()
return
}
@ -22,7 +26,12 @@ export default function bridgeTokens(req: Request, res: Response): void {
if (session?.accessToken == null) {
// The auth token decrypted fine, but this session has no connected Dropbox
// account — that is "not found", not an authentication failure.
res.status(404).json({ error: 'No Dropbox tokens for this session.' })
logger.info(
'bridge-tokens: no Dropbox tokens for this session',
'bridge-tokens',
req.id,
)
res.status(404).end()
return
}