Skip to content

Commit 2483758

Browse files
authored
Fix reset_password to handle wrapped API response (#406)
The WorkOS API returns password reset responses in wrapped format {"user": {...}} rather than a flat user object. This caused reset_password to return a User object with all nil fields despite successful API calls. Changes: - Updated reset_password to use UserResponse.new(response.body).user to correctly unwrap the API response (line 872) - Updated VCR cassette to match current API response format Verified: - Tested against real WorkOS API with local code changes - User object now correctly populated with all fields - All 119 user_management tests pass - Response format matches Go and Node.js SDK implementations - Resolves customer issue where password reset succeeded but returned User object with all null fields
1 parent 1931e3f commit 2483758

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/workos/user_management.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ def reset_password(token:, new_password:)
869869
),
870870
)
871871

872-
WorkOS::User.new(response.body)
872+
WorkOS::UserResponse.new(response.body).user
873873
end
874874

875875
# Get an Organization Membership

spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)