How to create an RPA Flow using the Get Microsoft OTP Code to login to Infor Tenant
Overview
This tutorial will show you how to create a basic flow for getting the OTP Code needed to login to the Infor tenant.
Components
- RPA
- RPA Management
- RPA Studio
Requirements
- You need to install the latest version of RPA Studio on your machine:
- Download the connection files
- Download RPA Installer from RPA Management. For this tutorial you need to install:
- IDE Studio
- Establish a connection between the RPA Studio and the RPA Management
- You can check the Infor RPA Studio User Guide for the details
- Before we start building the flow, let’s set up OTP:
- Have the MS Authenticator app installed on you mobile device.
- Enable MFA as part of your tenant settings and TOTP – for that see: Infor OS Admin Guide.
- Go to OS> Security> Security Administration> Settings> General Settings
- Expand the MFA Configuration
- Select the Enable MFA ad TOTP
- Click SAVE

Tutorial
Difficulty: Medium
Estimated completion time: 25 Minutes
This Flow would need to be divided into two Sections:
- Getting and Retrieving the secret key
- Flow Configuration (to login to a specific tenant).
1. Generating the Secret Key
Add the MFA Multi-factor Authentication (MFA) for your tenant user see details in: Infor OS User Guide Section: TOTP authentication and Adding a device with TOTP
- Click on your User Avatar and select User Settings
- Next in the navigating menu on the left side of the screen go to Security > Multi-factor Authentication (MFA)
- Click + Add New MFA and select TOTP
- Provide the Device Name

- Click on “Can’t scan it?”, and copy to clipboard the Secret Key. You will use it in RPA Studio
- Click back on Scan QR Code to show the QA code again.
- Scan the QR Code using the MS Authenticator App installed on your device and follow the instruction in the app.
- Click Next in tenant screen of device creation and enter the 6 digit OTP you see in the app meaning the MS Authenticator App for your tenant and click Next. If everything is successfully set up, you should be able to click Finish
2. Open RPA Studio
Open RPA Studio on your machine, and sign in, if required.
3. Create a new project
On the Home page click Create New Project and specify the following properties in the pop up window:
- Name: OTP Authentication
- ProjectLocation: <default>
- Description: OTP Authentication
- Language: VB <selected by default>
4. Start building the flow with User login and Password
Note: The XPath values used in all the activities below may not be valid for your tenant, you need to inspect the elements to get the appropriate XPath or CSS selector.
First add the Open Browser activity. You can find the list of activities by clicking Activities in the left-hand side bar or from the View menu in the top bar. Use search to find the activity you want.
We will define the following values for its properties:
- URL property is the URL of the application the bot is navigating to. Let’s create an argument for it:
- Name: URL, of type string with default value “<tenant URL>”

Next Add Maximize Window to show the browser window in a full screen.
Then you need to provide the user credentials. For that we will add Web/Set Text activity and configure it as follows:
- Create an argument called UserLogin, of type String with default value of your tenant login. Then add this to the Input argument called Text on the right side of the screen.
- For XPath or CSS Selector you need to provide the XPath of the element you want set the text to “//input[@id=’username’]”
- You can also change the DisplayName of the Set Text element to ‘Enter username’. This is not necessary, but it makes the flow clearer.

Next you need to add the same activity Web/Set Text activity to provide your password.
- For Input/Text we will create an argument called Password of type String and default value of your tenant password.
- For XPath or CSS Selector you need to provide the XPath of the element you want set the text to “//input[@id=’pass’]”
- You can also rename the Set Text box to ‘Enter pass’ for clarity.

5. Add a button to Sign in
Next in the flow, you need to click on the button to Sign in. For that you need the web/Click activity.
- For XPath or CSS Selector you need to provide the XPath of the element e..g “//*[@id=’loginpage’]/div[3]/button”

6. Get the OTP code
Add the Get Microsoft OTP Code activity into the modelling canvas.
- For the Secret Key property create the variable called SecretKey.
- Paste the SecretKey we generated in part 1 into the Default value cell.
- Note: Remove the spaces in the Secret Key when pasting the value.
- Paste the SecretKey we generated in part 1 into the Default value cell.
- For the OTPCode create a variable called OTPCode of type String.

7. Add a step to help with Troubleshooting
For the troubleshooting you can add the Message box activity to get the generated code. Configure it as follows:
- for Input Text specify the OTPCode variable. Note: Once you run this flow in production this activity should be either removed or Comment Out (an activity under Debug).

8. Add a step to Set the OTP code
Then we need to add the activity which will set the code in the appropriate text field. For that drag and drop Set Text activity and configure as follows:
- For Text specify the variable holding the value of the authentication code variable OTPCode
- For XPath or CSS Selector you need to provide the XPath of the element e..g “//*[@id=’totpCode’]”
Next you need to click on the button Authorize and for that we will use the Click activity:
- For XPath or CSS Selector you need to provide the XPath of the element e..g “//*[@id=’totpFormSignOn’]”

Now you can run the flow and see if you can login.