Skip to content

Commit

Permalink
Fix client creds auth (#429)
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
csanders-git authored Jan 13, 2025
1 parent 3807dce commit 07c77b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion okta/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 07c77b6

Please sign in to comment.