diff --git a/packages/http/httpx/kiota_http/httpx_request_adapter.py b/packages/http/httpx/kiota_http/httpx_request_adapter.py index 48c9e6a..9368322 100644 --- a/packages/http/httpx/kiota_http/httpx_request_adapter.py +++ b/packages/http/httpx/kiota_http/httpx_request_adapter.py @@ -564,10 +564,10 @@ async def retry_cae_response_if_required( if auth_header_value.casefold().startswith( self.BEARER_AUTHENTICATION_SCHEME.casefold() ): - claims_match = re.search('claims="(.+)"', auth_header_value) + claims_match = re.search('claims="([^"]+)"', auth_header_value) if not claims_match: raise ValueError("Unable to parse claims from response") - response_claims = claims_match.group().split('="')[1] + response_claims = claims_match.group(1) parent_span.add_event(AUTHENTICATE_CHALLENGED_EVENT_KEY) parent_span.set_attribute("http.retry_count", 1) return await self.get_http_response_message( diff --git a/packages/http/httpx/tests/test_httpx_request_adapter.py b/packages/http/httpx/tests/test_httpx_request_adapter.py index 89fdbe8..0df147e 100644 --- a/packages/http/httpx/tests/test_httpx_request_adapter.py +++ b/packages/http/httpx/tests/test_httpx_request_adapter.py @@ -394,7 +394,7 @@ async def test_retries_on_cae_failure( { "claims": ( "eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbH" - "VlIjoiMTYwNDEwNjY1MSJ9fX0" + "VlIjoiMTYwNDEwNjY1MSJ9fX0=" ) }, ),