Skip to content

Commit

Permalink
Merge branch 'shiling-main-patch-85500' into 'main'
Browse files Browse the repository at this point in the history
Update topt-plugin.md

See merge request documentation/uilicious-docs-v3!51
  • Loading branch information
Tai Shi Ling committed Oct 30, 2024
2 parents 1830356 + f55210a commit 03f1363
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/topt-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: How to generate time-based OTPs for 2FA testing

# Generating Time-based OTPs

This article covers how to use the built-in `topt` plugin to generate **time-based OTPs** for handling **2-Factor Authentication (2FA)** login flows.
This article covers how to use the built-in `totp` plugin to generate **time-based OTPs** for handling **2-Factor Authentication (2FA)** login flows.

This can be applied to Single Sign On (SSO) logins that support using OAUTH authentication, e.g. Google login, Github login, PingID, etc.

Expand Down Expand Up @@ -38,17 +38,17 @@ As an example, the steps below shows you how to get the OATH key for Google Logi

## Generating the OTP in your test

Once you have the OATH key, you can use the "topt" plugin to generate the OTP during test runs.
Once you have the OATH key, you can use the "totp" plugin to generate the OTP during test runs.

First, load the `topt` plugin into the test script.
First, load the `totp` plugin into the test script.

```javascript
let TOPT = TEST.loadPlugin("topt");
let TOTP = TEST.loadPlugin("totp");
```

Then, run `generateOTP`, passing in the OATH key, to generate the one-time password.
```javascript
let otp = TOPT.generateOTP("<oath_key>")
let otp = TOTP.generateOTP("<oath_key>")
```
By default, this will generate an 6-digit OTP, with a period of 30 seconds, using "SHA-1" algorithm.

Expand Down

0 comments on commit 03f1363

Please sign in to comment.