Skip to content

Commit 770d962

Browse files
committed
Fix "Cannot supply multiple client credentials." error for Okta users
1 parent 1e6d30a commit 770d962

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/fastapi_oauth2/core.py

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ async def token_data(self, request: Request, **httpx_client_args) -> dict:
124124
async with httpx.AsyncClient(auth=auth, **httpx_client_args) as session:
125125
try:
126126
response = await session.post(token_url, headers=headers, content=content)
127+
if response.status_code == 401:
128+
content = re.sub(r"client_id=[^&]+", "", content)
129+
response = await session.post(token_url, headers=headers, content=content)
127130
self._oauth_client.parse_request_body_response(json.dumps(response.json()))
128131
return self.standardize(self.backend.user_data(self.access_token))
129132
except (OAuth2Error, httpx.HTTPError) as e:

0 commit comments

Comments
 (0)