This is a pre-requisite step if your Action logic requires working with Gmail or outlook mail. You need to generate OAuth2.0 credential files and make them available for test execution.
Generating the files is a one-time, offline activity. So, be sure to follow these instructions and place the generated files in your local Agent folder so that authentication is successful when you are actually running the tests.
These steps need to be repeated for every email address that you intend to use as part of automation logic. However, same files can be copied over to multiple Local Agent machines if you need to run tests across multiple agents.
Step 1: Setup OAuth 2.0 on Google or Azure
Complete the pre-requisites for Azure/Google as described here.
If you are configuring Azure or Outlook email, skip to Step #2 below.
If you are using Gmail, a file is generated as a result of this step. Follow the instructions here:
Rename the client_secrets.json file as <user_id>.json. Where "user_id" is the email address being authorized, after replacing the special characters including the period "." character with "_" character. Only include the text before the "@" in the email address. For example, if the auth file is for the email address, "email@example.com", rename this file as "john_todd.json".
Copy this file to user_data/oauth/gmail directory on the Local Agent.
Step 2: Generate OAuth 2.0 credential files in ACCELQ
You may create a sample Action (need not be part of scenario flow) in your ACCELQ Project and insert the following command. Run this Action, which will generate a file in the specified folder. If no folder location is provided, defaults to the ACCELQ agent's user_data directory (the final destination of the file).
Command: Generate OAuth 2.0 credentials for azure and google
This command currently has support for Outlook and Gmail. Below are the details required to generate the OAuth credentials file to the given location.
Outlook: tenant id, client id
Gmail: google credentials file path (downloaded from google as part of pre-requisite steps)
Along with the above details, the user is allowed to provide required scopes that are supported by the provider. If no scopes are provided then it defaults to provider recommended scopes. Below are the details:
|Provider||ACCELQ default scopes||Available scopes|
If you are providing custom scopes, be sure to separate the scopes with a "comma".
Note: This command needs user interaction as explained below.
A browser tab will be invoked with the user consent screen. You need to consent to this for the authorization to be complete.
When you run the Action containing this command, a file is generated in the specified folder, with the name matching the email address. This file contains:
google: A binary file with the required access token, refresh token, and expiration details.
outlook: A JSON file with the required access token, refresh token, and expiration details.
Data in this credential file helps to generate new tokens upon expiration, for seamless automation.
If you gave a specific folder path (instead of leaving it blank), copy the generated file from this step and paste into the following folder on the Local Agent: