Skip to content

Conversation

@vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Sep 13, 2024

import { journey, step, mfa} from '@elastic/synthetics';

journey('2FA', ({ page }) => {
  step('Login using 2FA', async () => {
    // login using username and pass and go to 2FA in next page
    const token = mfa.totp(params.MFA_SECRET)
    await page.getByPlaceholder("token-input").fill(token)
  });
});
  • Users can also configure it for Inline and other Project based journeys by specifying these MFA secrets from params which would allow for generating the token at runtime instead of generating from the UI which would cause authentication issues as journeys would run past the period the token is valid for.
     const token = mfa.totp(params.MFA_SECRET)

@vigneshshanmugam vigneshshanmugam marked this pull request as ready for review September 13, 2024 21:55
shahzad31
shahzad31 previously approved these changes Sep 16, 2024
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

Tested with https://otplib.yeojz.dev/

and it seems to work as expected !!

shahzad31
shahzad31 previously approved these changes Sep 17, 2024
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

Copy link
Contributor

@emilioalvap emilioalvap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vigneshshanmugam vigneshshanmugam merged commit 8c13a27 into elastic:main Sep 18, 2024
@vigneshshanmugam vigneshshanmugam deleted the totp-support branch September 18, 2024 16:37
@obltmachine
Copy link

🎉 This PR is included in version 1.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@maggieghamry
Copy link

@vigneshshanmugam @shahzad31 can you please confirm if this release will only be available in 8.16 and if the TOTP support will include support for Speakeasy TOTP?

@kvesthy
Copy link

kvesthy commented Nov 25, 2024

@vigneshshanmugam There is discrepancy about the script below mfa.token

const token = mfa.token(params.MFA_GH_SECRET)

It should be

const token = mfa.totp(params.MFA_GH_SECRET)

Can you please review?

@vigneshshanmugam
Copy link
Member Author

@kvesthy Good catch, Sent out a fix to the docs. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants