GSuite Token

Hi All,

I am using the GSuites Activity and I got this error.

The client did not complete the token exchange after the default 60 seconds, and as a result the operation was canceled

Thanks in Advance.

cheers :smiley:

Happy learning :smiley:

1 Like

Hi Pattyricarte,

Please provide more details regarding your workflow.

I presume that you use GSuites activity scope with Authentication Type : OAuth Client ID. It is important to select te correct Services (if you use Get Mail Messages activity within the scope, please select Gmail scope).

When you run the workflow for the first time a new Web browser tab is opened for OAuth 2.0 Authentication Token. You may be asked to select the username, in the next tab go to Advanced and give access to the application you aready defined when following the steps from here https://docs.uipath.com/activities/docs/about-google-gsuite-activities .

It is relevant to have the correct scopes/services set in the scope activity otherwise if you will allow Sheets access (default) and not Gmail, the token is still not generated for mail and you get the same error.

Also if you do not click the Allow button in 60 seconds (when running with the correct scope), you will get the same error.

After the first successful run, a token is cached and for later runs the authorization window will not pop up.

Regards,
Daniela

3 Likes

Hi @DanielaD

Thanks for your advice, so much appreciated.

Scenario

  1. The robot will read the google sheet
  2. The robot will check if the google sheet has data or not
  3. If the robot determines that the google sheet has data, the robot will process the data and input the data to applications.
  4. If it doesn’t have data the robot will loop again and read again the google sheet until it will gain some data on it.

Image

image

Note

The issue trigger when the robot loops within the ReadGoogleSheet for such a long time.

image

cheers :smiley:

Happy learning :smiley:

1 Like

Hi @pattyricarte ,

Since the logic is related only with Google Sheets, I would recomment for you to use Google Application Scope activity with Authentication Type : API Key. After defining the API Key credetials in Google Cloud Platform (steps provided in the documentation), you’ll also have to share the spreadsheet with the google account from which it is accessed (otherwise at runtime it will give an API error of access forbidden).

If you want to use the Authentication Type: OAuth Client ID, please create a small workflow for test with only one activity: Google Application scope and Read Range activity inside (in order to pinpoint the issue, check if the first read is successful or the problem lays in the loop). Is the test with one activity executing successful? After the first successful run and after you have clicked the Accept authorize button, a token file is generated in %AppData%\Datastore.GSuite. Do you have a file on the disk in this location?

If you have it, you could delete it and trigger the generation of another file at the next workflow execution. Do you see the authorization window when you execute again, after deleting the token file?

Regards,
Daniela

3 Likes

Hello, excuse me, but in my automation using gsuite applications, every time I run it it always asks for authorization in the chrome browser, I don’t suppose that if I give it access, this problem should no longer appear?

Hi @borismh,

It can happen to ask for authorization in chrome browser again, after you already gave access, in the following scenario: presuming I have a loop in which I use email activities (configured with email scope) after with sheets activities (configured with Sheets scope). I should use GSuite scope configured with both sheets and email scopes in both places, so that only one token is generated for both accesses.

Regards,
Daniela

1 Like