workos-ruby icon indicating copy to clipboard operation
workos-ruby copied to clipboard

Unable to access `pending_authentication_token` in error response

Open joshpensky opened this issue 1 year ago • 1 comments

Hi there!

We are testing out not-so-happy paths in our authentication flow, and found an issue with the password auth flow: https://workos.com/docs/reference/user-management/authentication/password

When the user's email is not verified, we expect to receive a email_verification_required error. However, the handle_error_response method in the WorkOS client doesn't pass along the code or pending_authentication_token fields to the default APIError class:

https://github.com/workos/workos-ruby/blob/68133ff28a86541effa65bd464d95efacd2320f6/lib/workos/client.rb#L169-L173

Could y'all make it so the else case here passes along the code and original error response if available?

Our workaround for now is to drop down to using the REST API via Faraday

joshpensky avatar Feb 29 '24 05:02 joshpensky