Skip to content

Commit

Permalink
fix(auth): 🚑️ Don't allow user without id
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Feb 24, 2022
1 parent cc1dd51 commit 7e7596d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions apps/builder/pages/api/typebots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import { methodNotAllowed } from 'utils'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const session = await getSession({ req })

if (!session?.user)
return res.status(401).json({ message: 'Not authenticated' })

const user = session.user as User
if (!user.id) return res.status(401).json({ message: 'Not authenticated' })
try {
if (req.method === 'GET') {
const folderId = req.query.folderId ? req.query.folderId.toString() : null
Expand Down

2 comments on commit 7e7596d

@vercel
Copy link

@vercel vercel bot commented on 7e7596d Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7e7596d Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

app.typebot.io
builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app

Please sign in to comment.