Skip to content

fix: regenerate methods to include missing params#610

Merged
gjtorikian merged 1 commit intomainfrom
update
Apr 13, 2026
Merged

fix: regenerate methods to include missing params#610
gjtorikian merged 1 commit intomainfrom
update

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

Description

v6 wasn't regenerated with the latest and greatest spec; this PR adds some newly introduced params.

@gjtorikian gjtorikian requested review from a team as code owners April 13, 2026 18:30
@gjtorikian gjtorikian requested a review from csrbarber April 13, 2026 18:30
@gjtorikian gjtorikian merged commit 6792792 into main Apr 13, 2026
10 checks passed
@gjtorikian gjtorikian deleted the update branch April 13, 2026 18:31
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR regenerates the UserManagement and AsyncUserManagement authentication methods to add three new optional context params (ip_address, device_id, user_agent) to every authenticate_with_* method, and correctly promotes several previously-Optional arguments (e.g. code, email, pending_authentication_token) to required positional-keyword args. Tests are updated to supply the now-required arguments.

  • authenticate_with_device_code (sync and async) still omits the client_secret body field that all other authenticate methods include — this is a pre-existing gap worth addressing while the method is being edited.

Confidence Score: 4/5

Safe 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

Filename Overview
src/workos/user_management/_resource.py Adds ip_address/device_id/user_agent optional params to all authenticate methods (sync + async) and promotes several previously-Optional required args to non-optional; authenticate_with_device_code still omits client_secret unlike every other method.
tests/test_user_management.py Updates sync and async test invocations to supply newly required arguments; no coverage added for new optional params.

Sequence Diagram

sequenceDiagram
    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
Loading

Comments Outside Diff (1)

  1. tests/test_user_management.py, line 700-707 (link)

    P2 New required params not asserted in request body

    The tests confirm grant_type but don't assert that the newly required or optional params (code, ip_address, device_id, user_agent, etc.) are actually serialised into the request body. Adding a body assertion — even just assert body["code"] == "test_value" — would catch a regression if the body-building logic were accidentally removed. This applies consistently to all the updated test methods.

Reviews (1): Last reviewed commit: "fix: regenerate methods to include missi..." | Re-trigger Greptile

Comment on lines 417 to 422
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should authenticate_with_code_pkce also get ip_address, device_id, user_agent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants