Skip to content

fix: forward Radar context from authenticate_with_code_pkce#620

Merged
gjtorikian merged 2 commits intomainfrom
fix/pkce-radar-params
Apr 15, 2026
Merged

fix: forward Radar context from authenticate_with_code_pkce#620
gjtorikian merged 2 commits intomainfrom
fix/pkce-radar-params

Conversation

@workos-sdk-automation
Copy link
Copy Markdown
Contributor

Summary

  • Add ip_address, device_id, and user_agent kwargs to authenticate_with_code_pkce (sync + async) and forward them into the request body.
  • Matches the parameter surface of every other authenticate_with_* helper (e.g., authenticate_with_password, authenticate_with_code).
  • The PKCE wrappers live inside # @oagen-ignore-start / # @oagen-ignore-end regions, so they were skipped by the generator when the rest of the auth surface picked up Radar params — this is the manual catch-up.

Fixes #618.

Test plan

  • uv run pytest tests/test_inline_helpers.py — 25 passed
  • New tests assert Radar fields are forwarded when provided and omitted when not, for both sync and async paths

🤖 Generated with Claude Code

Add ip_address, device_id, and user_agent kwargs to the PKCE code
exchange helpers (sync + async) and forward them into the request body,
matching the other authenticate_with_* helpers. The PKCE wrappers live
in @oagen-ignore blocks, so they missed the Radar params when the rest
of the auth surface picked them up.

Fixes #618

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@workos-sdk-automation workos-sdk-automation bot requested review from a team as code owners April 15, 2026 17:32
@workos-sdk-automation workos-sdk-automation bot requested a review from tribble April 15, 2026 17:32
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 15, 2026

Greptile Summary

This PR adds ip_address, device_id, and user_agent (Radar context) parameters to authenticate_with_code_pkce on both the sync UserManagement and async AsyncUserManagement classes, bringing them into parity with every other authenticate_with_* helper. The implementation is inside @oagen-ignore regions, so the generator skip is correctly explained. Tests cover both the forward-fields and omit-when-absent paths for sync and async, and the previously flagged missing async omit test has been added.

Confidence Score: 5/5

This PR is safe to merge — it is a straightforward additive change with no breaking modifications.

All changes are additive optional parameters behind is not None guards, matching the established pattern of every other authenticate_with_* helper. Both sync and async paths are updated symmetrically, and test coverage for forward and omit cases is complete for both paths. No P0 or P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
src/workos/user_management/_resource.py Adds ip_address, device_id, user_agent kwargs to both sync and async authenticate_with_code_pkce; body inclusion is correctly guarded with is not None checks, matching the pattern used across other authenticate_with_* methods.
tests/test_inline_helpers.py Adds test_forwards_radar_context and test_omits_radar_context_when_not_provided to both TestAuthKitPKCECodeExchange (sync) and TestAsyncAuthKitPKCECodeExchange (async), giving symmetric coverage.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant authenticate_with_code_pkce
    participant WorkOS API

    Caller->>authenticate_with_code_pkce: code, code_verifier,
ip_address?, device_id?, user_agent?
    authenticate_with_code_pkce->>authenticate_with_code_pkce: build body
(grant_type, client_id, code, code_verifier)
    alt Radar params provided
        authenticate_with_code_pkce->>authenticate_with_code_pkce: append ip_address / device_id / user_agent
    end
    authenticate_with_code_pkce->>WorkOS API: POST /user_management/authenticate
    WorkOS API-->>authenticate_with_code_pkce: AuthenticateResponse
    authenticate_with_code_pkce-->>Caller: AuthenticateResponse
Loading

Reviews (2): Last reviewed commit: "test: add async omit-radar-context test ..." | Re-trigger Greptile

Comment thread tests/test_inline_helpers.py
Mirrors the sync coverage so both classes assert Radar fields are
absent from the body when not provided. Addresses Greptile review on #620.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gjtorikian gjtorikian merged commit 32aea77 into main Apr 15, 2026
10 checks passed
@gjtorikian gjtorikian deleted the fix/pkce-radar-params branch April 15, 2026 17:45
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.

authenticate_with_code_pkce missing ip_address, device_id, user_agent args

1 participant