🚑 (auth) Fix bad requests with getSession on server side

This commit is contained in:
Baptiste Arnaud
2023-04-03 16:42:10 +02:00
parent b96a3a6a8e
commit 49071b73b6
39 changed files with 112 additions and 91 deletions

View File

@@ -5,7 +5,7 @@ import { notAuthenticated } from '@typebot.io/lib/api'
import { SmtpCredentials } from '@typebot.io/schemas'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)
const user = await getAuthenticatedUser(req, res)
if (!user) return notAuthenticated(res)
if (req.method === 'POST') {
const { from, port, isTlsEnabled, username, password, host, to } = (

View File

@@ -10,7 +10,7 @@ import { setUser } from '@sentry/nextjs'
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)
const user = await getAuthenticatedUser(req, res)
if (!user) return notAuthenticated(res)
setUser({ email: user.email ?? undefined, id: user.id })

View File

@@ -11,7 +11,7 @@ import { setUser } from '@sentry/nextjs'
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)
const user = await getAuthenticatedUser(req, res)
if (!user) return notAuthenticated(res)
setUser({ email: user.email ?? undefined, id: user.id })