MCPcopy Create free account
hub / github.com/AnswerOverflow/AnswerOverflow / handler

Function handler

apps/dashboard/src/pages/api/auth/[...nextauth].ts:6–20  ·  view source on GitHub ↗
(
	req: NextApiRequest,
	res: NextApiResponse<any>,
)

Source from the content-addressed store, hash-verified

4import { Auth } from '@answeroverflow/core/auth';
5import type { NextApiRequest, NextApiResponse } from 'next';
6export 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}

Callers

nothing calls this directly

Calls 1

isOnMainSiteFunction · 0.90

Tested by

no test coverage detected