Skip to main content
Glama

MCP Server NestJS

by Cstannahill
jwt.strategy.ts963 B
import { ExtractJwt, Strategy } from 'passport-jwt'; import { PassportStrategy } from '@nestjs/passport'; import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; interface JwtPayload { sub: number; username: string; iat?: number; exp?: number; } @Injectable() export class JwtStrategy extends PassportStrategy(Strategy) { constructor(private configService: ConfigService) { // Using the same approach as auth.module.ts for consistency const envSecret = process.env.JWT_SECRET; const secretKey = envSecret || 'fallback_secret_for_dev'; super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), secretOrKey: secretKey, }); } validate(payload: JwtPayload) { console.log('JwtStrategy.validate payload:', payload); const user = { userId: payload.sub, username: payload.username }; console.log('JwtStrategy.validate returns user:', user); return user; } }

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/Cstannahill/mcp-server-nestjs'

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