This article walks you through the process of configuring Email OAuth 2.0 for Microsoft Office 365 Azure in ACCELQ. It covers the steps needed to create an app registration, assign necessary permissions, and generate OAuth 2.0 authentication credentials for seamless email automation within ACCELQ.
Pre-requisite: Admin setup
Before beginning the configuration, ensure that you have the necessary administrative privileges. Specifically, a "Cloud Application Administrator" is required to complete steps 1 to 3. This is a one-time setup to create the app registration, assign permissions, and retrieve essential IDs. Make sure you have access to the Microsoft Entra Admin Center and the ability to add users to the app registration. Your Admins can do these steps for you.
Note: From Step 1 to Step 3 requires a "Cloud Application Administrator" privilege.
Step 1: Create an App Registration
- Navigate to the Microsoft Entra Admin Center.
- Go to Identity > Applications > App registrations from the left navigation bar and select New registration.
- Enter a registration name (e.g., "ACCELQ Email").
- In the Redirect URI section, select the platform as "mobile & desktop" and set the redirect URI to http://localhost.
- Click the Register button.
- Navigate to Authentication from the left navigation bar. Under Advanced settings, set Allow public client flows to "Yes".
- Click Save.
Step 2: Allow Users to Use This App Registration
- Navigate to Owners from the left side navigation bar.
- Click Add owners and add all the users who will be using this app registration.
Step 3: Get the Client ID and Tenant ID
- Navigate to Overview from the left side navigation bar.
- Copy the Client ID and Tenant ID. These IDs will be used by the users added as owners in the next steps.
Now that the app registration is created, users can generate OAuth 2.0 authentication credentials using the Client ID and Tenant ID.
Generate OAuth 2.0 or Authentication credential files in ACCELQ
You may create a sample Action in your ACCELQ Project and insert the following command.
Command: Generate azure/google authentication token
Important: The Action containing this command must not be part of Scenario flow.
Let's understand each parameter usage of this command for Outlook Office 365 OAuth 2.0:
- Email ID: Enter the user's email ID.
NOTE: This email ID must be added as one of the owners for the App Registration, as mentioned in the previous section(Pre-requisite: Admin setup[Step 2]). -
Cache Folder Path: Directory to save the generated file (optional). You can leave this blank.
-
Service: Choose "outlook."
-
Tenant ID: Tenant ID copied from the App Registration "overview" page, as explained in the previous section(Pre-requisite: Admin setup[Step 3]).
-
Client ID: Client ID copied from the App Registration "overview" page, as explained in the previous section(Pre-requisite: Admin setup[Step 3]).
-
Scopes: This is an optional field and you can leave this blank. This allows users to provide required scopes that are supported by the provider. If you are providing custom scopes, be sure to separate the scopes with a "comma".
If no scopes are provided, it defaults to provider-recommended scopes. Below are the default scopes automatically set internally if scopes are left blank: -
Browser Selection: This parameter defines which browser to open. You can choose between "system-default", "Chrome", "Edge", "Firefox", and "Safari".
After filling in all the parameters as described above, run the Action as an independent job or playback the command statement. This will open an independent browser/tab in your preferred browser and take you to a Microsoft login page. Log in to the Microsoft Office 365 account using the same username you used in the command.
After a successful login, you will be redirected to a blank page with the message "Authentication complete. You can close the browser and return to the application"
Upon successful command execution, a file is generated in the below folder, with the name matching the email address.
~\ACCELQAgent\AgentInstances\agent\user_data\auth_token\outlook
This is a JSON file containing the required access token, refresh token and expiration details. The data in this credential file helps generate new tokens upon expiration for seamless automation.
Note: This step (running the logic involving this command statement) must be repeated on every Agent machine where you plan to execute Scenarios involving email-related commands. Alternatively, you may copy the JSON file from one Agent machine and place it in the same directory (~\ACCELQAgent\AgentInstances\agent\user_data\auth_token\outlook) on all the Agent machines.
Writing Automation Logic
You can now use all the Email library commands to write your Action logic. Here is an article explaining Email testing.
Comments
0 comments
Please sign in to leave a comment.