Block reference / Data

Get OTP

Work out the current 6-digit two-factor code from its secret.

In both appsWarpX BrowserWarpX Phone

Get OTP gives you the code an authenticator app would show right now, from the secret the account's two-factor setup handed out. Use it just before a login step asks for the code, then type the code with OTP input or Type text. It does not need a tab open.

The Get OTP block's settings, filled in as in the example below.

Settings

OTP secret

The base32 secret, such as JBSWY3DPEHPK3PXP. Spaces, hyphens and case do not matter. Rather than typing it in, reference it: from the profile's resources as {{Resource.Facebook.2Fa}}, or from Credentials as {{secrets.facebook2fa}}.

Example{{Resource.Facebook.2Fa}}
Assign to variable

Store the code in a variable.

ExampleChecked
Variable namewhen Assign to variable is ticked

The variable that receives the code.

ExampleotpCode
Insert to table

Also put the code into a cell of the table.

ExampleUnchecked
Select columnwhen Insert to table is ticked

The column that receives the code.

Exampleotp

Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.

What it hands on

A 6-digit code as text, leading zeros kept. It goes to the variable or column you chose, and on as {{prevBlockData}}.

Example: Sign in with the profile's Facebook two-factor code

  1. Open URL
  2. Type text
  3. Click element
  4. Get OTP
  5. OTP input
Where Get OTP sits in the example workflow.
  1. Give the profile a Facebook account under its resources, with a 2Fa field holding the secret.
  2. In the workflow, sign in with Type text using {{Resource.Facebook.Username}} and {{Resource.Facebook.Password}}.
  3. When the code page shows, add Get OTP and type {{Resource.Facebook.2Fa}} in OTP secret.
  4. Tick Assign to variable and type otpCode.
  5. Add OTP input on the code boxes with the value {{variables.otpCode}}.

On WarpX Phone

  • A WarpX Phone run has no profile and so no profile resources: {{Resource.Facebook.2Fa}} stays as typed and the block stops with The OTP secret is not valid base32. Keep the secret in Credentials and write {{secrets.facebook2fa}}, or read it from the table or a file.

Good to know

  • The code is the standard 30-second, 6-digit kind. It is worked out when the block runs, so run the block right before the code is typed.
  • {{Resource.<Platform>.<Field>}} is read from the profile the workflow runs in. The field name must match the resource's field exactly, such as 2Fa. If the profile has no such account, the reference stays as typed and the block stops with The OTP secret is not valid base32.
  • An empty secret stops the block with The OTP secret is empty.
  • The secret is your second factor. Keep it in the profile's resources or in Credentials, so the workflow file does not carry it.

See also

  • OTP input — Type a one-time code into a row of boxes that take one character each.
  • Type text — Put text into an input, textarea or editable element.
  • Forms — Fill a text field, choose a dropdown option, or tick a checkbox or radio button.