Skip to main content
Glama
route.ts927 B
import { NextRequest, NextResponse } from 'next/server'; export async function POST(request: NextRequest) { try { const { apiKey } = await request.json(); if (!apiKey) { return NextResponse.json( { error: 'Missing API key' }, { status: 400 } ); } const response = NextResponse.json({ success: true }); // Set httpOnly cookie with JWT response.cookies.set('api_key', apiKey, { httpOnly: true, secure: process.env.NODE_ENV === 'production', sameSite: 'lax', maxAge: 300, // 5 minutes path: '/api/auth/callback' }); return response; } catch (error) { console.error('Init OAuth error:', error); return NextResponse.json( { error: 'Failed to initialize OAuth' }, { status: 500 } ); } }

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/superglue-ai/superglue'

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