( req: NextApiRequest, res: NextApiResponse<any>, )
| 4 | import { Auth } from '@answeroverflow/core/auth'; |
| 5 | import type { NextApiRequest, NextApiResponse } from 'next'; |
| 6 | export default async function handler( |
| 7 | req: NextApiRequest, |
| 8 | res: NextApiResponse<any>, |
| 9 | ) { |
| 10 | const token = req.cookies[Auth.getTenantCookieName()]; |
| 11 | if (token) { |
| 12 | const nextAuthSession = await Auth.findTenantSessionByToken(token); |
| 13 | // add a cookie to the request using the next auth header |
| 14 | req.cookies[Auth.getNextAuthCookieName()] = nextAuthSession?.sessionToken; |
| 15 | } |
| 16 | if (!isOnMainSite(req.headers.host!)) { |
| 17 | Auth.disableSettingCookies(res); |
| 18 | } |
| 19 | await NextAuth(req, res, Auth.authOptions); |
| 20 | } |
nothing calls this directly
no test coverage detected