From 66b5e2631ebf2259274f9265f219e226435707c1 Mon Sep 17 00:00:00 2001 From: saidsurucu Date: Wed, 9 Jul 2025 17:55:45 +0300 Subject: [PATCH] Update asgi_app.py --- asgi_app.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/asgi_app.py b/asgi_app.py index cde0d0a..3c69137 100644 --- a/asgi_app.py +++ b/asgi_app.py @@ -126,12 +126,20 @@ async def mcp_protocol_handler(request: Request): if auth_header and auth_header.startswith("Bearer "): token = auth_header.split(" ")[1] try: - # Validate Clerk JWT token - from clerk_backend_api import Clerk - clerk = Clerk(bearer_auth=os.getenv("CLERK_SECRET_KEY")) + # Validate Clerk JWT token using correct imports + from clerk_backend_api.security.verifytoken import verify_token + from clerk_backend_api.security.types import VerifyTokenOptions + + # Create verification options + options = VerifyTokenOptions( + secret_key=os.getenv("CLERK_SECRET_KEY"), + api_url="https://api.clerk.com", + api_version="v1", + audience=None # Skip audience validation to avoid issues + ) # Validate Clerk JWT token directly - jwt_claims = clerk.jwt_templates.verify_token(token) + jwt_claims = verify_token(token, options) user_id = jwt_claims.get("sub") if user_id: