Skip to content

Commit ccc8b71

Browse files
Fix type errors in KeycloakAuthProvider URL handling
Convert AnyHttpUrl types to str for httpx and JWTVerifier compatibility: - Cast registration_endpoint to str in httpx.post() call - Cast jwks_uri and issuer to str in JWTVerifier initialization
1 parent df735d2 commit ccc8b71

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/fastmcp/server/auth/providers/keycloak.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,12 @@ def __init__(
141141
# Create default JWT verifier if none provided
142142
if token_verifier is None:
143143
token_verifier = JWTVerifier(
144-
jwks_uri=self.oidc_config.jwks_uri,
145-
issuer=self.oidc_config.issuer,
144+
jwks_uri=str(self.oidc_config.jwks_uri)
145+
if self.oidc_config.jwks_uri
146+
else None,
147+
issuer=str(self.oidc_config.issuer)
148+
if self.oidc_config.issuer
149+
else None,
146150
algorithm="RS256",
147151
required_scopes=settings.required_scopes,
148152
audience=None, # Allow any audience for dynamic client registration
@@ -290,7 +294,7 @@ async def register_client_proxy(request):
290294
forward_headers["Content-Type"] = "application/json"
291295

292296
response = await client.post(
293-
self.oidc_config.registration_endpoint,
297+
str(self.oidc_config.registration_endpoint),
294298
content=body,
295299
headers=forward_headers,
296300
)

0 commit comments

Comments
 (0)