Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
5cb97a7
1
Parent(s): 0653d45
Fix typing
Browse files
src/fastmcp/client/auth/oauth.py
CHANGED
|
@@ -80,7 +80,7 @@ class OAuthClientProvider(_MCPOAuthClientProvider):
|
|
| 80 |
ServerOAuthMetadata instead of the restrictive MCP OAuthMetadata.
|
| 81 |
"""
|
| 82 |
# Extract base URL per MCP spec
|
| 83 |
-
auth_base_url = self.
|
| 84 |
url = urljoin(auth_base_url, "/.well-known/oauth-authorization-server")
|
| 85 |
|
| 86 |
from mcp.types import LATEST_PROTOCOL_VERSION
|
|
|
|
| 80 |
ServerOAuthMetadata instead of the restrictive MCP OAuthMetadata.
|
| 81 |
"""
|
| 82 |
# Extract base URL per MCP spec
|
| 83 |
+
auth_base_url = self.context.get_authorization_base_url(server_url)
|
| 84 |
url = urljoin(auth_base_url, "/.well-known/oauth-authorization-server")
|
| 85 |
|
| 86 |
from mcp.types import LATEST_PROTOCOL_VERSION
|
src/fastmcp/server/auth/auth.py
CHANGED
|
@@ -43,3 +43,18 @@ class OAuthProvider(
|
|
| 43 |
self.client_registration_options = client_registration_options
|
| 44 |
self.revocation_options = revocation_options
|
| 45 |
self.required_scopes = required_scopes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
self.client_registration_options = client_registration_options
|
| 44 |
self.revocation_options = revocation_options
|
| 45 |
self.required_scopes = required_scopes
|
| 46 |
+
|
| 47 |
+
async def verify_token(self, token: str) -> AccessToken | None:
|
| 48 |
+
"""
|
| 49 |
+
Verify a bearer token and return access info if valid.
|
| 50 |
+
|
| 51 |
+
This method implements the TokenVerifier protocol by delegating
|
| 52 |
+
to our existing load_access_token method.
|
| 53 |
+
|
| 54 |
+
Args:
|
| 55 |
+
token: The token string to validate
|
| 56 |
+
|
| 57 |
+
Returns:
|
| 58 |
+
AccessToken object if valid, None if invalid or expired
|
| 59 |
+
"""
|
| 60 |
+
return await self.load_access_token(token)
|