Build a secure user authentication backend with this powerful n8n workflow. Includes signup, signin, and password reset using PostgreSQL's pgcrypto for bcrypt hashing.
Download this n8n workflow template and start using it instantly.
Implementing a secure authentication system traditionally requires complex server-side coding. This n8n workflow simplifies the process by leveraging the power of PostgreSQL's built-in cryptographic functions (pgcrypto) and the flexible routing capabilities of the n8n node ecosystem.
This robust n8n workflow centralizes user management into one endpoint. When an external application (like a front-end UI or mobile app) calls the webhook, the system securely handles user creation (signup with bcrypt hashing), credential verification (signin), and automatic password generation (forgot password). It serves as an excellent example of using an n8n trigger for external API interaction while maintaining high security standards. This particular n8n workflow drastically cuts down development time for backend authentication services.
The automation begins with a dedicated n8n trigger:
/auth endpoint. The request body must contain path (specifying 'signup', 'signin', or 'forgot'), email, and optionally, password or name.Router, analyzes the path value from the incoming request. It directs the execution flow to the appropriate PostgreSQL logic branch.path is 'signup', the flow hits the Signup PostgreSQL n8n node. This node executes a SQL query using crypt() and gen_salt('bf') to securely hash the user's password using bcrypt before insertion.path is 'signin', the Login PostgreSQL n8n node queries the user by email (case-insensitive) and uses PostgreSQL's crypt() function to compare the provided password against the stored hash. The result, including a boolean isPasswordMatch, passes to the Check Login n8n node.Check Login IF n8n node verifies if both a user ID was found and the password matched. It routes the result to either a success or failure response.path is 'forgot', the Reset Password n8n node generates a new 8-character random password, updates the user record, and returns the new plain-text password for immediate user display or for emailing.status, message, data) back via the Respond n8n node.To deploy this powerful n8n workflow, follow these steps:
users table. Ensure the uuid-ossp and pgcrypto extensions are enabled in your database.CREATE TABLE users (
id uuid PRIMARY KEY DEFAULT uuidgeneratev4(),
fullname text NOT NULL,
email text UNIQUE NOT NULL,
passwordhash text NOT NULL,
created_at timestamptz DEFAULT now()
);Signup, Login, and Reset Password n8n node configurations, assign your PostgreSQL credential set (e.g., 'Project: Edubot'). Webhook (n8n trigger):
Function: Serves as the single API endpoint (/auth) for all authentication actions.
Key Configuration: Method set to POST; Response Mode set to 'Response Node'.
Router (Switch n8n node):
Function: Routes the execution based on the path variable ($json["path"]), directing traffic to 'signup', 'signin', or 'forgot'.
Key Configuration: Uses three outputs corresponding to the three required paths.
Signup (PostgreSQL n8n node):
Function: Inserts a new user record. Uses crypt('{{$json["password"]}}', gen_salt('bf')) for secure password hashing.
Login (PostgreSQL n8n node):
Function: Retrieves user data and compares the incoming password against the stored hash using a secure SQL query that returns isPasswordMatch.
Check Login (IF n8n node):
Function: Core flow control logic. Validates the results of the Login query (checks if user exists and password matches).
Key Configuration: Condition checks id existence AND isPasswordMatch equals true.
Reset Password (PostgreSQL n8n node):
Function: Generates a random 8-character string and updates the user's password hash in the database.
Respond (n8n node):
* Function: Finalizes the request by sending the status, message, and data back to the client that initiated the n8n trigger.
Use this powerful n8n workflow to deploy a complete AI HR department. Featuring a strategic CHRO agent and specialist teams (Recruiter, Policy Writer, Compensation), this n8n automation leverages OpenAI O3 and GPT-4.1-mini for cost-effective, complex HR solutions.

Deploy a complete AI Engineering Department using this advanced n8n workflow. The CTO n8n agent delegates tasks to specialized DevOps, Security, and Architect agents powered by OpenAI models.

Deploy a robust RAG chatbot using n8n templates, Pinecone, and OpenAI. This dynamic n8n workflow automatically ingests PDFs from Google Drive to create a searchable knowledge base.

Deploy a sophisticated RAG pipeline using an n8n workflow. Integrate Slack, Google Sheets, Pinecone vector database, and Azure OpenAI to build a context-aware AI Agent.

Build a sophisticated multilingual AI voice agent using n8n, GPT-5, Google Calendar, and Google Sheets. This advanced n8n workflow automates support, scheduling, and email confirmations.








































