RPA.MFA is a library for generating one-time passwords (OTP).

Added on rpaframework version: 16.0.0

Based on the pyotp package.

In the below example the mfa secret we are reading from the Robocorp Vault is the passcode generated by the Authenticator service. The passcode value is stored into the Vault with key otpsecret.

Passcode is typically a long string (16-32 characters), which is provided in a form of QR image, but it can be obtained by requesting access to a string.

Note that same code can be used to add a mobile phone as a authentication device at the same as the same code is added into the Vault.

Robot framework example usage:

*** Settings ***
Library     RPA.Robocorp.Vault
Library     RPA.MFA

*** Tasks ***
Generate time based code
    ${secrets}=    Get Secret   mfa
    ${code}=    Get Time Based OTP    ${secrets}[otpsecret]

Python example usage

from RPA.Robocorp.Vault import Vault
from RPA.MFA import MFA

def main():
    secrets = Vault().get_secret("mfa")
    code = MFA().get_time_based_otp(secrets["otpsecret"])