fix: ⏪️ Remove credentials name check
This commit is contained in:
@ -1,13 +1,8 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { drive } from '@googleapis/drive'
|
import { drive } from '@googleapis/drive'
|
||||||
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
||||||
import {
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
||||||
badRequest,
|
import { setUser, withSentry } from '@sentry/nextjs'
|
||||||
forbidden,
|
|
||||||
methodNotAllowed,
|
|
||||||
notAuthenticated,
|
|
||||||
} from 'utils'
|
|
||||||
import { captureException, setUser, withSentry } from '@sentry/nextjs'
|
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
@ -22,14 +17,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
if (!auth)
|
if (!auth)
|
||||||
return res.status(404).send("Couldn't find credentials in database")
|
return res.status(404).send("Couldn't find credentials in database")
|
||||||
console.log(auth.credentials.name, user.email)
|
console.log(auth.credentials.name, user.email)
|
||||||
if (auth.credentials.name !== user.email) {
|
|
||||||
captureException(
|
|
||||||
new Error(
|
|
||||||
`Credentials name does not match user email ${auth?.credentials.name} !== ${user.email}`
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return forbidden(res)
|
|
||||||
}
|
|
||||||
const response = await drive({
|
const response = await drive({
|
||||||
version: 'v3',
|
version: 'v3',
|
||||||
auth: auth.client,
|
auth: auth.client,
|
||||||
|
Reference in New Issue
Block a user