diff --git a/backend/app/main.py b/backend/app/main.py index caeff73..ba88ce4 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -89,6 +89,13 @@ async def auth_callback(payload: AuthCallbackRequest): async with httpx.AsyncClient(timeout=15.0) as client: response = await client.post(token_endpoint, data=data, headers={"Accept": "application/json"}, auth=auth) + # Some providers only accept client authentication via POST body + if response.status_code != 200 and auth is not None: + # try falling back to client_secret in the request body + data_with_secret = dict(data) + data_with_secret["client_secret"] = settings.oidc_client_secret + response = await client.post(token_endpoint, data=data_with_secret, headers={"Accept": "application/json"}) + if response.status_code != 200: raise HTTPException(status_code=400, detail=f"OIDC token exchange failed: {response.text}")