From e814612fdfa3f0bc82fc0992e4a01a85841fc3e1 Mon Sep 17 00:00:00 2001 From: Chaim Sanders Date: Thu, 2 Jan 2025 13:51:00 -0800 Subject: [PATCH] Fix client creds auth #424 seems to break client creds based auth because it uses create_request() wrong, which will lead to a POST request to /oauth2/v1/token with a JSON body, content-type application/json. But this endpoint does not accept this content-type and returns with 'Accept and/or Content-Type headers likely do not match supported values.'. Instead it expects the content-type to be 'application/x-www-form-urlencoded', and the client assertion needs to be form encoded. This corrects that issue. --- okta/oauth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/okta/oauth.py b/okta/oauth.py index 680987ae..002c11c7 100644 --- a/okta/oauth.py +++ b/okta/oauth.py @@ -58,7 +58,7 @@ async def get_access_token(self): # Craft request oauth_req, err = await self._request_executor.create_request( - "POST", url, {'client_assertion': jwt}, { + "POST", url, form={'client_assertion': jwt}, headers={ 'Accept': "application/json", 'Content-Type': 'application/x-www-form-urlencoded' }, oauth=True)