Skip to content
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

Add a guide for MFA in k6 tests #1881

Open
yorugac opened this issue Feb 27, 2025 · 0 comments
Open

Add a guide for MFA in k6 tests #1881

yorugac opened this issue Feb 27, 2025 · 0 comments
Labels
Area: browser The browser module Area: OSS Content Improvements or additions to community/oss documentation examples Issues about a missing example frontline Issues related to project frontline

Comments

@yorugac
Copy link
Contributor

yorugac commented Feb 27, 2025

While it is generally advised to avoid MFA in tests, sometimes it simply cannot be avoided. We don't have any guide for these use cases now.

Taking inspiration from this video, it should be possible to implement a similar flow with k6-browser as well. And add there something like this with otpauth package:

import * as OTPAuth from "https://unpkg.com/[email protected]/dist/otpauth.esm.js"
import crypto from 'k6/experimental/webcrypto';
globalThis.crypto = crypto.crypto;

export let options = {
    iterations: 1
};

export default function () {
    let totp = new OTPAuth.TOTP({
        issuer: "ACME",
        label: "Alice",
        secret: "US3WHSG7X5KAPV27VANWKQHF3SH3HULL",
    });

    let secret = new OTPAuth.Secret({ size: 128 });
    let token = totp.generate();
    console.log("token", token);
}
@yorugac yorugac added Area: OSS Content Improvements or additions to community/oss documentation Area: browser The browser module examples Issues about a missing example frontline Issues related to project frontline labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: browser The browser module Area: OSS Content Improvements or additions to community/oss documentation examples Issues about a missing example frontline Issues related to project frontline
Projects
None yet
Development

No branches or pull requests

1 participant