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

Code equals nil in WorkOS::MFA.challenge_factor response

Open tomczak-mateusz opened this issue 1 year ago • 1 comments

Hey, I'm using WorkOS MFA in my customer project & utilise Ruby gem. Everything works as expected but I was able to find one confusing response:

When running a challenge_factor request I can see an attribute code: nil for WorkOS::Challenge in response (and it returns nil for this attribute for any auth_factor_id), example:

irb(main):003> auth_factor_id = Member.find(2).mfa_sms_auth_factor_id
=> "auth_factor_01J50D363JX20ZVRZE2M2P****"

irb(main):004> challenge = WorkOS::MFA.challenge_factor(authentication_factor_id: auth_factor_id)
=>
#<WorkOS::Challenge:0x00000001223d0248
...

irb(main):005> challenge
=>
#<WorkOS::Challenge:0x00000001223d0248
 @authentication_factor_id="auth_factor_01J50D363JX20ZVRZE2M2P****",
 @code=nil,
 @created_at="2024-08-12T12:39:09.808Z",
 @expires_at="2024-08-12T12:49:09.809Z",
 @id="auth_challenge_01J539JZ7MH51DWBTDJ1W6****",
 @object="authentication_challenge",
 @updated_at="2024-08-12T12:39:09.808Z">

I can see that Code is NOT covered in the Authentication Challenge documentation as well: https://workos.com/docs/reference/user-management/mfa/authentication-challenge image

I would suggest to either remove Code from response or to document it properly.

tomczak-mateusz avatar Aug 12 '24 13:08 tomczak-mateusz

Thanks for the report! That's indeed an unused parameter, I'll make a note to remove this in the next major version.

PaulAsjes avatar Aug 13 '24 11:08 PaulAsjes