RPA.MFA

RPA.MFA is a library intended mainly for generating one-time passwords (OTP) and not only, as OAuth2 support was introduced lately.

Library requires at the minimum rpaframework version 19.4.0.

Based on the pyotp and requests_oauthlib packages. It provides support for both MFA with the * OTP related keywords and OAuth2 "Authorization Code Flow" with the * OAuth * related keywords.

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 duplicate authentication device at the same time when the same code is added into the Vault.

Robot framework example usage:

*** Settings *** Library RPA.MFA Library RPA.Robocorp.Vault *** Tasks *** Generate time based code ${secrets}= Get Secret mfa ${code}= Get Time Based OTP ${secrets}[otpsecret]

Python example usage

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

Importing

Initialize self. See help(type(self)) for accurate signature.