-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for optional mfa #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested, but it looks good to me
const authType = subcodeArray[1]; | ||
|
||
return { | ||
mfaType: authType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yes, sorry the preference is always 'MFA required:AUTHENTICATOR_APP'
first if they have both
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
hasAuthy
flag will indicate if also enrolled in SMS)POST login
to trigger the Authy prompt.logout
command 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> -g
raisely login
(and thenraisely logout
if 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