How to Implement OAuth 2.0 in Uipath for bot accessing Google sheet data uninteruptedly

I have Client ID & Client Code with me, using Gsuite application scope with OAuth 2.0 bot was able to get data from googlesheet, but problem is that once in a while browser opens up & asks for user consent.

I want to eliminate this consent thing. anyonce can help me?

Hi @achyuth_sai

Welcome to our UiPath Forum! :slight_smile:

Please check this post and let us know if it was helpful :slight_smile:

Hi loginerror,

Thanks for the reference post, i have verified the location & windows users are same , there is no change in the scope too.

bot will try to read one specific Google sheet every time it is using the Gsuite application scope.

I still have the user authentication issue after every one hour. I dont understand why is it asking every one hour.

Hi achyuth_sai,

There is no way to eliminate the consent screen for good.
Access to services through OAuth2 is done based on an access token that keeps getting updated without you knowing.
This is happening because when the consent screen is shown, we obtain a refresh token. No consent screen no refresh token. It is the refresh token that is used when needing a new access token.
The amount of time a refresh token lasts depends on the scopes being used, but it is anywhere between a few hours to a few days.

That being said, it is curious that you get the consent screen every single time. This should not be happening.

In the upcoming release of the GSuite package, which includes Docs functionality, we’ve worked to better manage the lifetime of stored refresh tokens, and i think you will notice a big decrease in consent screens being shown.
Still, the consent screen will be shown anytime your refresh token is expired.

1 Like

Hi Mihai,

Looking forward for the next release, Although the consent screen was appearing every hour periodically.

With your inputs can i assume that OAuth 2.0 is not for Unattended bots right?


You are correct, OAuth2 is for attended and service account for unattended. API Key is just for reading public documents so it’s unlikely to be used much in a business setting.

However, even if OAuth2 is meant for attended robots, you can transform it into unattended by using a parallel activity with 3 branches, 2 clicks and the scope.

Also, check for the updated GSuite package this week, and if you are so kind please do let me know how often the consent screen pops up now!



@Mihai_Dunareanu Do you have a working example of using the parallel activity to accept the oauth2 screen. I have been trying to get this to work however with the parallel activity however it will not do the clicks that I have programmed

1 Like

Dear Nicholas, please show the single steps. I face the same problem by trying the following:

  1. Activate the Explorer/Chrome
  2. Click on the apropriate user
  3. Scroll Down
  4. Click on the accept button
  5. Close Explorer/Chrome

Hi all,

I would recommend you try using the DataStoreLocation → Orchestrator option, which stores the token response on Orchestrator. You can then have a single attended machine running an empty GSuite Application Scope and saving the token_response, and all your unattended robots using and updating that token.

It’s a much cleaner and long term viable option than creating a robot to complete the OAuth2 screen (what if google introduces captha there?).

1 Like

Hi! I’m testing this orchestrator option of datalocation for token response but I keep on getting “you are not authorized!” message. I think it has something to do with the orch user role, what role settings should I tick to make this work?

Hi @Emman_Pelayo

You can check this video


Nived N :robot:

Happy Automation :smiling_face::smiling_face::smiling_face:

I guess I am coming late to the topic, but someone might find this useful.
OAuth is not suitable for Unattended robots, use the service account instead.
The video below is describing the connection process.

Good luck!