Skip to content

Commit 07c77b6

Browse files
authored
Fix client creds auth (#429)
#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.
1 parent 3807dce commit 07c77b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

okta/oauth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async def get_access_token(self):
5858

5959
# Craft request
6060
oauth_req, err = await self._request_executor.create_request(
61-
"POST", url, {'client_assertion': jwt}, {
61+
"POST", url, form={'client_assertion': jwt}, headers={
6262
'Accept': "application/json",
6363
'Content-Type': 'application/x-www-form-urlencoded'
6464
}, oauth=True)

0 commit comments

Comments
 (0)