Connecting to Google Tasks and other google products using a service account

I can’t use OAuth on my n8n install because I’m only running it on a local network (so the OAuth Redirect URL is just an IP). While I can use Google docs/sheets/drive using the service account, n8n is not giving me an option to use those credentials for Google Tasks, Calendar, Contacts.

Is OAuth the only option here, or am I missing something?

Hey @Kajvezd, welcome to the community :tada:

You’re not missing anything, only a few Google nodes support the Service Account auth method unfortunately: Google - n8n Documentation

That said, the redirect should be a frontend-only thing (meaning even a redirect to localhost:5678 would work), so unless Google blocks private IPs from being used in a redirect URL you should still be able to use OAuth2.

The only thing not possible would be receiving webhooks from the internet, but you could consider using n8n’s tunnel service to work around this during development/testing.

Thanks! I love n8n but the learning curve has been very steep, imo.

I tried a bunch of ways to implement the redirect either through nginx proxy_pass or through Traefik and I still haven’t gotten to make it work, but that’s outside the scope of this forum.

Seeing you mention nginx, that’s exactly how my instance is set up. Assuming you have a public domain name, you could check out this guide I wrote a while back on how to configure n8n behind an nginx reverse proxy.

You can ignore the Oracle Cloud specific parts, what’s relevant for OAuth would be:

  • The WEBHOOK_URL environment variable (so n8n knows what the right domain name is). In the guide I configure it via docker-compose.yml, so if you run n8n any other way you’d need to adjust it slightly.
  • The nginx server block

Once the WEBHOOK_URL variable is set and the nginx reverse proxy is up and running, n8n should use the correct redirect URLs. Give me a shout if you run into any trouble with this.