How to connect generic gmail account (*@gmail.com) to n8n

Problem description

I want to use a gmail trigger node to track some email received and use the content to fill up a google sheet.
I have 2 problems:

  • Using OAuth2 authentication, the flow is working properly but since the app is not published on Google it automatically stop working after 7 days.
  • Using a service account, I can validated the credential but gmail trigger node provides an error message: “ERROR: Precondition check failed.”

My request

  • Can I use a service account to connect to my personnal gmail account and if yes, how to avoid this error?
  • If OAuth is the only way for gmail (without a workspace account with dedicated domain), is there a process that can be share to publish the google developper app even if the use would be limited to 1 gmail user? Or to use a generic n8n app even from an hosted n8n instance? or to set the app to 1 gmail account only and by doing so not having to publish the app?

Information on my n8n setup

  • n8n version: 0.224.4
  • Running n8n via npm
  • Operating system: Debian

Thank you for any help

Hey @Remi_BAUBY,

Welcome to the community :raised_hands:

I use the normal OAuth option, You can publish the app without it being public. I am not sure if a service account can work with gmail accounts I suspect it probably could, I know with Google Workspace you typically have to add the service account to the org to get it working but I am not sure how you would do that with GMail accounts.

It is probably easier to just use the oauth approach, Did you try to publish it?

Hi Jon, thank you for your answer.

I didn’t try to publish the app yet. My concern is that since it’s Gmail and not google workspace, it cannot be a private app. Therefore to publish the app I first need to add:

  • A privacy policy published online for the app
  • A youtube video presenting how the app will use end user data
  • An explanation to let Google understand why my app need these access
  • Domain validation in google search console.

Again since I’m using n8n mostly for personnal needs so far and that it’s my personnal gmail account tha I want to connect, I cannot really provide all of these.
Is there a way to bypass verification and limit the app to a single user for instance but with no restriction? Or if someone has been able to publish a google app in similar condition, what did you use for these requirements?

Hey @Remi_BAUBY,

I didn’t have to do any of that for mine, I think it all depends on which APIs you enable but you should be ok.

Thanks for your replies Jon.

You are right it’s a question of scope for the app. In my case since I wanted to read content of email it’s one of the most private ressource you can think of. Therefore validation must be done with youtube video, public privacy policy and others…

I guess, I’ll have to find another way because it would make things much more complicated.

Hey @Remi_BAUBY,

I also read the contents of email and I didn’t have to do the validation, Have you tried it anyway?

Yes, a few testing later, it’s working now with a published app, hopefully it will remain this way.

After a few tests including creating a new Google dev project for some testing and coming across a scope error in n8n. I eventually found a way to validate the app with limited scope and validate scope in OAuth screen later…

The complexity lied on the Google side to be honest, but again thanks for your comments as it’s helpful to know that there is a way to make it work and hopefully, it will carry on working properly.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.