From 7d186d60902a051fffbe67607d17698dfeadb501 Mon Sep 17 00:00:00 2001 From: Martyn Hill Date: Wed, 16 Jul 2025 09:01:55 +0100 Subject: [PATCH] Requirements for oAuth compliance --- httpx_auth/_oauth2/client_credentials.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/httpx_auth/_oauth2/client_credentials.py b/httpx_auth/_oauth2/client_credentials.py index ea46520..de7c5d5 100644 --- a/httpx_auth/_oauth2/client_credentials.py +++ b/httpx_auth/_oauth2/client_credentials.py @@ -3,6 +3,8 @@ from typing import Union, Iterable import httpx +import urllib.parse + from httpx_auth._authentication import SupportMultiAuth from httpx_auth._oauth2.common import ( OAuth2BaseAuth, @@ -97,7 +99,10 @@ def request_new_token(self) -> tuple: return (self.state, token, expires_in) if expires_in else (self.state, token) def _configure_client(self, client: httpx.Client): - client.auth = (self.client_id, self.client_secret) + encoded_client = urllib.parse.quote(self.client_id, safe="") + encoded_secret = urllib.parse.quote(self.client_secret, safe="") + + client.auth = (encoded_client, encoded_secret) client.timeout = self.timeout