Get Mail Messages Gsuite - Precondition check failed [400]

Hi Team,

I am trying to use Gsuite Application Scope for Get Mail Message Activity and use Service Account Key as authentication method.

I tried with following ways:

  1. Get a service account key in .p12 format, updated key path, service account email and password
    Error Received: Precondition check failed [400]
  2. Get a service account key in json format, updated key path.
    Error Received: Precondition check failed [400]
    After reading some of the Forum posts, checked Has Domain Wide Access checkbox, and gave my personal email address as User’s email
    Error Received: Unauthorized email address

Can anyone help me with following questions:

  1. How to solve this precondition check failed when using Service account key authentication in .p12 format? Not getting what I am doing wrong here?

  2. When using Account key in JSON format and checking HasDomainWideAccess, can you tell me which user’s email address we need to provide (Personal gmail address?). In Google console under the service account which I am using there is Domain Wide Delegation option under Advanced Settings, but i couldn’t find any option to enable it. Seems it is only available for Google Workspace account.

  3. If roles/permission needs to be setup for Service account key authentication, how to do it, what roles do I need to set up. I tried with Service Account Admin and Key Admin but received same error (Precondition check failed)
    In configuration scope for Gsuite in UiPath - and auth/drive scopes are checked.


For mail auth and driver scope is not enough

Generally this error occurs when any required value in google api is missing

That can be many missing things once please show some screenshots of what values youa re usingn

Also try checking if the exception details from locals panel has any details


Hi @Karan_Katle

  1. Precondition Check Failed with .p12 Format:
    The “Precondition Check Failed” error generally indicates that there’s an issue with the authentication or authorization process. Some possible reasons for this error could include:

    • Incorrect path to the .p12 key file.
    • Incorrect service account email or password.
    • Incorrectly configured scopes in UiPath.

    Double-check that you’ve provided the correct path to the .p12 key file, the service account email, and password. Also, ensure that you have selected the appropriate scopes required for your intended operations (e.g., reading mail).

  2. Account Key in JSON Format and HasDomainWideAccess:
    If you are using a JSON format key and trying to enable domain-wide delegation, it’s important to note that domain-wide delegation is generally intended for Google Workspace (formerly G Suite) accounts, not personal Gmail accounts. When enabling domain-wide delegation, you would provide the email address of a super admin or admin account from your Google Workspace domain, not a personal Gmail address.

  3. Setting Up Roles/Permissions for Service Account:
    The roles you need to set up depend on the specific tasks the service account needs to perform. For accessing Gmail, you typically need the appropriate Gmail scopes. The scope might be relevant for reading mail.

    If you’re encountering permission issues, here’s a general outline of what you might do in the Google Cloud Console:

    • Go to IAM & Admin > IAM.
    • Find your service account and click on it.
    • Click the “+ Add Member” button.
    • Enter the email of the service account and assign relevant roles like “Gmail Read” or custom roles.

Hope it helps!!

Hello @Anil_G @Parvathy ,

After adding the following highlighted Authentication Scopes in Gsuite Configuration scope, now I am getting an error as:

Get Mail Messages: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See Integrating Google Sign-In into your web app  |  Authentication  |  Google for Developers. [401]

This is my Get Mail Message Activity:

And following is the properties of Gsuite Application Scope:

Is I am doing anything wrong here?


Please done add all…check what is the scope you gave while provisioning and better you need only email so give only that in UiPath and check


Hi @Anil_G ,
If we add a scope of “” or “” only, then I am getting precondition check failed [400].

If I add a scope of “” then the error is: Get Mail Messages: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential [401]

Hello All,

I am also facing same error Please refer the screenshot. Any solutions/suggestions?