fix: regenerate methods to include missing params#610
Conversation
Greptile SummaryThis PR regenerates the
Confidence Score: 4/5Safe to merge after verifying whether client_secret is intentionally absent from the device code flow. All changes are clean and consistent; the only concern is the pre-existing omission of client_secret in authenticate_with_device_code (sync + async), which the PR edits without fixing. If that grant type genuinely doesn't require client_secret in the WorkOS API, the score would be 5/5. src/workos/user_management/_resource.py — specifically the authenticate_with_device_code method (lines 417–436 and the async equivalent ~2581–2600). Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant UserManagement
participant WorkOSAPI
Caller->>UserManagement: authenticate_with_*(code, ..., ip_address?, device_id?, user_agent?)
UserManagement->>UserManagement: build body dict (grant_type, required params)
UserManagement->>UserManagement: conditionally add client_id, client_secret
UserManagement->>UserManagement: conditionally add ip_address, device_id, user_agent
UserManagement->>WorkOSAPI: POST /user_management/authenticate
WorkOSAPI-->>UserManagement: AuthenticateResponse JSON
UserManagement-->>Caller: AuthenticateResponse
|
| body: Dict[str, Any] = { | ||
| "grant_type": "urn:ietf:params:oauth:grant-type:device_code", | ||
| "device_code": device_code, | ||
| } | ||
| if self._client.client_id is not None: | ||
| body["client_id"] = self._client.client_id |
There was a problem hiding this comment.
client_secret missing from device code token request
authenticate_with_device_code omits the client_secret block that every other authenticate method includes (e.g. authenticate_with_password at line 173, authenticate_with_code at line 208). This is a pre-existing gap, but since this PR is editing the method it's the right time to align it. If the WorkOS API requires client_secret for this grant type, device code authentication will silently omit it. The same omission exists in AsyncUserManagement.authenticate_with_device_code.
| @@ -2285,19 +2356,27 @@ async def authenticate_with_password( | |||
| async def authenticate_with_code( | |||
There was a problem hiding this comment.
Should authenticate_with_code_pkce also get ip_address, device_id, user_agent?
Description
v6 wasn't regenerated with the latest and greatest spec; this PR adds some newly introduced params.