Skip to main content
Glama
auth.middleware.ts715 B
// @ts-nocheck import { getSession } from "@auth/express" import { authConfig } from "../config/auth.config.js" import type { NextFunction, Request, Response } from "express" export async function authenticatedUser( req: Request, res: Response, next: NextFunction, ) { const session = res.locals.session ?? (await getSession(req, authConfig)) ?? undefined res.locals.session = session if (session) { return next() } res.status(401).json({ message: "Not Authenticated" }) } export async function currentSession( req: Request, res: Response, next: NextFunction, ) { const session = (await getSession(req, authConfig)) ?? undefined res.locals.session = session return next() }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpauth/mcpauth'

If you have feedback or need assistance with the MCP directory API, please join our Discord server