Support for Google service account user impersonation [GOT CREATED]

I’m currently using the Google Drive node, but this issue exists for all Google nodes.

When using a Google service account and uploading a file, the file is owned by the service account and is not visible to anyone. It is not possible to transfer ownership to a user either because of outside domain restrictions.

In Drive, a workaround is to share a users folder with the service account email. Then the file will show up. However, it would be much better if the service account would impersonate a properly configured user to perform certain actions (upload, move, share, delete, etc…). Then the file is truly owned by the desired user, and no additional configuration on folders is required. Additionally, this approach is much better than having a user actually authenticate an OAuth session in n8n.

It seems this is possible. See:

The answer appears here.

Essentially, what I think this would look like in the node for Drive (or Calendar, etc…) would be an addtional option in n8n to enter the impersonated user’s email address for the call. Assuming everything is configured properly in Google Cloud Platform, it should work.


@Trevor_Gildersleeve Just added this. If you can test it locally and let me know if it works fine would be cool. Currently, it’s implemented just for Google Drive. if it works for you I will add it to the other Google services.

btw check the image below, I believe that has to be active.

@RicardoE105 Thanks for the amazingly quick add.

I did have the Domain-wide Delegation turned on.

I just tested your change and now it works perfectly!

The n8n team is amazing!

Thank you :smiley:

1 Like

Made some changes and it will work with Sheets, Drive and Books which are currently the only services that use Service Account credentials. Would that be enough to cover your use case? @Trevor_Gildersleeve

@RicardoE105, yes that covers everything and more. Thank you very much!


Cool. My co-worker will review it as well and then it will be included in the next release.

1 Like

Got released with [email protected]

@RicardoE105 and @jan Thank you!