Accept additional response_types values from OAuth servers (#1323)
This commit is contained in:
parent
146d7efb0f
commit
1940040ac3
2 changed files with 70 additions and 2 deletions
|
|
@ -77,6 +77,17 @@ class RegistrationHandler:
|
|||
status_code=400,
|
||||
)
|
||||
|
||||
# The MCP spec requires servers to use the authorization `code` flow
|
||||
# with PKCE
|
||||
if "code" not in client_metadata.response_types:
|
||||
return PydanticJSONResponse(
|
||||
content=RegistrationErrorResponse(
|
||||
error="invalid_client_metadata",
|
||||
error_description="response_types must include 'code' for authorization_code grant",
|
||||
),
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
client_id_issued_at = int(time.time())
|
||||
client_secret_expires_at = (
|
||||
client_id_issued_at + self.options.client_secret_expiry_seconds
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ class OAuthClientMetadata(BaseModel):
|
|||
"authorization_code",
|
||||
"refresh_token",
|
||||
]
|
||||
# this implementation only supports code; ie: it does not support implicit grants
|
||||
response_types: list[Literal["code"]] = ["code"]
|
||||
# The MCP spec requires the "code" response type, but OAuth
|
||||
# servers may also return additional types they support
|
||||
response_types: list[str] = ["code"]
|
||||
scope: str | None = None
|
||||
|
||||
# these fields are currently unused, but we support & store them for potential
|
||||
|
|
|
|||
Loading…
Reference in a new issue