# User authentication system with Gmail and Postgres: n8n workflow

> Started by another system calling it, and works across Gmail and Postgres. 23 steps, 5 branches: large, and worth reading before you trust it with anything...

Source: https://millionrounds.com/workflow/user-authentication-system-with-gmail-and-postgres (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Alerts and monitoring](https://millionrounds.com/workflows?category=Alerts+and+monitoring#library)

# User authentication system with Gmail and Postgres

Started by another system calling it, and works across Gmail and Postgres. 23 steps, 5 branches: large, and worth reading before you trust it with anything live.

Large

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fuser-authentication-system-with-gmail-and-postgres)

**23 steps** Large: read it before trusting it with anything live

**5** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 4 Logic 12 Service 7

The steps in the order they run, from what starts it.

- 1 **Webhook Entry** Webhook *Starts it*
- 2 **Check OPTIONS Request** If *Logic*
- 3 **Respond to OPTIONS** Respond To Webhook *Starts it*
- 4 **Route by Action** Switch *Logic*
- 5 **Generate Password** Crypto *Service*
- 6 **Verify Credentials** Postgres *Service*
- 7 **Check User Exists** Postgres *Service*
- 8 **Create User Account** Postgres *Service*
- 9 **Handle Login Result1** Code *Logic*
- 10 **Is User Not Found** If *Logic*
- 11 **Check Signup Error1** If *Logic*
- 12 **Check Login Status** If *Logic*
- 13 **Error Response** Respond To Webhook *Starts it*
- 14 **Code in JavaScript** Code *Logic*
- 15 **Success Response** Respond To Webhook *Starts it*
- 16 **Handle Signup Error1** Code *Logic*
- 17 **Extract Email** Set *Logic*
- 18 **Save Reset Code** Postgres *Service*
- 19 **Generate Welcome Email** Code *Logic*
- 20 **email2** Set *Logic*
- 21 **Send Welcome Email** Gmail *Service*
- 22 **Generate HTML Email2** Code *Logic*
- 23 **Send a message2** Gmail *Service*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 23, with 5 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Postgres
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Gmail and Postgres accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 23 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 23 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fuser-authentication-system-with-gmail-and-postgres)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also alerts and monitoring, with the same services where possible, closest in size first.

- [**Analyze contract risk from PDFs with OpenAI and Supabase** 23 steps · Gmail, Slack](https://millionrounds.com/workflow/analyze-contract-risk-from-pdfs-with-openai-and-supabase)
- [**Monitor customer risk and AI feedback with PostgreSQL** 23 steps · Discord, Gmail](https://millionrounds.com/workflow/monitor-customer-risk-and-ai-feedback-with-postgresql)
- [**URL and IP lookups with Greynoise and VirusTotal** 23 steps · Gmail, Slack](https://millionrounds.com/workflow/url-and-ip-lookups-with-greynoise-and-virustotal)
- [**Automate Reddit replies with F5Bot and OpenAI** 23 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automate-reddit-replies-with-f5bot-and-openai)
- [**Detect and correct claims cost leakage with OpenAI** 23 steps · calls a model · Email, Postgres](https://millionrounds.com/workflow/detect-and-correct-claims-cost-leakage-with-openai)
- [**Monitor attack surface changes with OpenAI and Postgres** 23 steps · calls a model · Email, Postgres](https://millionrounds.com/workflow/monitor-attack-surface-changes-with-openai-and-postgres)
