Skip to content

Commit 9463fef

Browse files
authored
Merge pull request #24 from ogment-ai/fix/bearer-auth
Fix: HTTP Bearer token authentication not being recognized in streamable-http transport
2 parents b62e4b7 + acc403b commit 9463fef

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎meta_ads_mcp/core/api.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import asyncio
77
import functools
88
import os
9-
from .auth import needs_authentication, get_current_access_token, auth_manager, start_callback_server, shutdown_callback_server
9+
from . import auth
10+
from .auth import needs_authentication, auth_manager, start_callback_server, shutdown_callback_server
1011
from .utils import logger
1112

1213
# Constants
@@ -203,7 +204,7 @@ async def wrapper(*args, **kwargs):
203204
# If access_token is not in kwargs or not kwargs['access_token'], try to get it from auth_manager
204205
if 'access_token' not in kwargs or not kwargs['access_token']:
205206
try:
206-
access_token = await get_current_access_token()
207+
access_token = await auth.get_current_access_token()
207208
if access_token:
208209
kwargs['access_token'] = access_token
209210
logger.debug("Using access token from auth_manager")

‎meta_ads_mcp/core/authentication.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
import asyncio
3030
import os
3131
from .api import meta_api_tool
32-
from .auth import start_callback_server, shutdown_callback_server, auth_manager, get_current_access_token
32+
from . import auth
33+
from .auth import start_callback_server, shutdown_callback_server, auth_manager
3334
from .server import mcp_server
3435
from .utils import logger, META_APP_SECRET
3536
from .pipeboard_auth import pipeboard_auth_manager

‎meta_ads_mcp/core/duplication.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Optional, Dict, Any, List, Union
77
from .server import mcp_server
88
from .api import meta_api_tool
9-
from .auth import get_current_access_token
9+
from . import auth
1010
from .http_auth_integration import FastMCPAuthIntegration
1111

1212

@@ -204,7 +204,7 @@ async def _forward_duplication_request(resource_type: str, resource_id: str, acc
204204

205205
# Use provided access_token parameter if no Facebook token found in context
206206
if not facebook_token:
207-
facebook_token = access_token if access_token else await get_current_access_token()
207+
facebook_token = access_token if access_token else await auth.get_current_access_token()
208208

209209
# Validate we have both required tokens
210210
if not pipeboard_token:

0 commit comments

Comments
 (0)