Send application_type during Dynamic Client Registration (SEP-837) (#2930)

This commit is contained in:
Marcelo Trylesinski 2026-06-20 17:19:12 +01:00 • committed by GitHub
commit cf41441e44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 38 deletions

View file

@ -1,6 +1,7 @@
"""Tests for refactored OAuth client authentication implementation."""
import base64
import json
import time
from unittest import mock
from urllib.parse import parse_qs, quote, unquote, urlparse
@ -1049,6 +1050,21 @@ class TestCreateClientRegistrationRequest:
assert request.method == "POST"
def test_registration_request_sends_application_type():
"""SEP-837: the DCR body carries application_type, defaulting to native and overridable."""
redirect_uris: list[AnyUrl] = [AnyUrl("http://localhost:3000/callback")]
default_request = create_client_registration_request(
None, OAuthClientMetadata(redirect_uris=redirect_uris), "https://auth.example.com"
)
assert json.loads(default_request.content)["application_type"] == "native"
web_request = create_client_registration_request(
None, OAuthClientMetadata(redirect_uris=redirect_uris, application_type="web"), "https://auth.example.com"
)
assert json.loads(web_request.content)["application_type"] == "web"
class TestAuthFlow:
"""Test the auth flow in httpx."""

View file

@ -203,6 +203,7 @@ async def test_the_dcr_request_carries_the_client_metadata() -> None:
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"scope": "mcp",
"application_type": "native",
"client_name": "interaction-suite",
"software_id": "interaction-test-suite",
}