Connect action for Google packages

Use the Connect action to establish a connection with the Google server in order to use other actions from that same package to automate tasks. All of the fields in this action accept a credential from the Credential Vault, variable, or a user-input value.

Prerequisites

Configure the OAuth settings in the Google Cloud Platform and retrieve the credentials necessary to connect Automation Anywhere with your Google G Suite applications.
  1. If you have not already done so, create a project.
  2. Enable the APIs for the Google G Suite applications you want to automate, such as the Google Drive API, Google Calendar API, and Google Sheets API.
  3. Do the steps in Setting up OAuth 2.0 to generate the Client ID and Secret.
    Note:
    • Select the Web application option and enter a name.
    • Based on the authentication mode, enter the relevant redirect URI as given below:
      • Authorization code (default authentication mode): Add this authorized redirect URI http://localhost:8888/Callback.
      • Control Room managed: Add the Callback URL from Control Room > Manage > OAuth connections > Connection settings page. See Create OAuth connection.

Procedure

  1. In the Actions palette, double-click or drag the Connect action from the package you want to use.
  2. In the Username field, you can provide a valid username or select the credential or credential variable that contains your Google username. To enter a value, click Insecure string.
  3. If you are configuring the Connect action for the Google Calendar or Google Sheets package, enter a session name.
  4. Click the OAuth2 Authentication Mode drop-down and select one of the following authentication modes:

    For an attended authentication mode, select Authorization code, which is a legacy flow and not secure. For the unattended authentication mode, select Control Room managed OAuth2 authentication, a more secure and standard model for automations.

    • Authorization code
      • In the Client Id field, select the credential or credential variable that contains the client ID. To enter a value, click Insecure string.
      • In the Redirect URI field, enter http://localhost:8888/Callback
        Note: For the Google Sheets package, the Redirect URI attribute is not supported. Enter the fixed redirect URL directly in Google Cloud Platform: http://localhost:8888/Callback
      • In the Client secret field, select the credential or credential variable that contains the access token. To enter a value, click Insecure string.
    • Control Room managed

      To use Control Room managed OAuth2 in Google packages, you must configure the OAuth connection in the Control Room. See Create OAuth connection.

      Update the information in the following fields:

      • Connection: Click the Pick button to select a connection type.
      • Select Custom in the Provider type field.
      • Select the connection name that you set up in the Control Room for Google Workspace apps.

      • Use the Token type field to select one of the following options:

        For information about the Google Workspace application access and refresh tokens, see Configure enterprise applications

        • Shared: Select this option when the OAuth2 access token is shared for all users running the automation. Note that this requires the Control Room administrator or any user (with Manage connections and View connections options enabled for the OAUTH CONNECTIONS) to set up an OAuth connection in the Control Room. Save the login credentials one time to generate a shared access token that can be consumed by all users running the automation.
        • User-specific: Select this option when the OAuth2 access token is specific to each user running the automation. Note that this requires the Control Room administrator or any user (with Manage connections and View connections options enabled for the OAUTH CONNECTIONS) to set up an OAuth connection in the Control Room. Ensure you do not save the login credentials so that each user running the automation can provide their login credentials and generate an access token that can only be consumed by that specific user.
        • Click Confirm.

          Using the Control Room managed OAuth2 option

      Note: When you use User-specific option, you must log in to your Google account to authenticate and generate a user-specific token. Perform the following steps to use this option:
      1. In the Control Room, navigate to your profile My settings > OAuth connections.
      2. Click Login to authenticate.
      3. Sign in to your Google account and select Continue.
      4. Verify the services you have access to and Click Continue.

        If the connection is succeeded, it will display the status as Active.

        OAuth authentication success status

  5. For Google Sheets, you can specify the wait time (in minutes) in the Wait for action to complete (In minutes) field when performing actions such as Get, Set, or Delete. By default, the wait time is 10 minutes.
    If the Google sheet does not open within the time you specify, the task proceeds to execute the next set of actions.
    Note: When you use Connect action to connect to the Google server, the option Wait for action to complete (In minutes) is only supported in Google Sheets package.
  6. Click Save.
  7. After you add actions from a specific Google package, use the Disconnect action from that same Google package to terminate the connection.

Next steps

The first time the bot runs, the Google login window is displayed. You must select the Google account and approve the requested access permissions.

The token file gets generated for the first time after you provide the access permissions when the bot gets deployed. It is created based on values that you provide in the Username, Client Id and Client secret field, and asks for credentials only the first time to provide the access permission. Next time it uses the same token file to connect to the Google Sheets.

The token file is located at C:\Users\<username>\AppData\Local\AutomationAnywhere\G-SuitAuth, where C:\Users\<username> is the user home directory of the respective system.

If you enter the correct credentials when providing access permissions for the first time and can connect to the Google Sheets successfully, then next time if there is a change in only the password, you need not delete the token file as it will work as expected.

Use other the actions from the same Google package to automate tasks. To use actions from another Google packages, establish a connection using the Connect action from that package.