Skip to content

Add a guide for MFA in k6 tests #1881

Open
@yorugac

Description

@yorugac

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: OSS ContentImprovements or additions to community/oss documentationArea: browserThe browser moduleexamplesIssues about a missing examplefrontlineIssues related to project frontline

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions