Conversation
chrisjensen
left a comment
There was a problem hiding this comment.
Haven't tested, but it looks good to me
| const authType = subcodeArray[1]; | ||
|
|
||
| return { | ||
| mfaType: authType, |
There was a problem hiding this comment.
Is the array order guaranteed?
There's no risk here that we return
{ mfaType: 'AUTHY', hasAuthy: false } when they have both?
There was a problem hiding this comment.
Yes, it's guaranteed. The API will return either:
- 'MFA required:AUTHY'
- 'MFA required:AUTHENTICATOR_APP'
- 'MFA required:AUTHENTICATOR_APP:hasAuthy'
There was a problem hiding this comment.
And yes, sorry the preference is always 'MFA required:AUTHENTICATOR_APP' first if they have both
There was a problem hiding this comment.
You can see here that the API now makes the preferred app the Authenticator App, so it will throw that error first if the user has both, unless the user specifies it wants to use Authy (which doesn't happen here in the CLI until after they select Authy).
🔍 What should we check?
🍒 What have you changed?
hasAuthyflag will indicate if also enrolled in SMS)POST loginto trigger the Authy prompt.logoutcommand in case the token saved to the raisely json expires - this clears it.⚡ Which issue does this solve?
The Raisely API is changing to support multiple MFA options.
The CLI will not work once users enrol in another MFA option.
This PR makes sure to support the existing implementation and also when the Raisely API changes for the login flow which offers these multiple options.
To test, you can run this branch locally and test the package:
npm install <path to cli> -graisely login(and thenraisely logoutif your token expires at any point)develop:-- your test user has an authy enrolment (you should get authy prompt)
-- your test user has an authenticator app enrolment (to set up you can see test instructions on this PR)
-- your test user has both an authenticator app enrolment and authy enrolment
---- selecting authenticator app and then using otp should work
---- selecting authy should send prompt and then using otp should work