The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Auth Service (MongoDB Production)",
"nodes": [
{
"parameters": {
"httpMethod": "GET",
"path": "api/auth/me",
"options": {}
},
"name": "Get User Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
0,
0
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.headers[\"x-acl-auth-key\"]}}",
"operation": "equal",
"value2": "acl_live_sec_8f92a3b4"
}
]
}
},
"name": "Security Guard Me",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
200,
0
]
},
{
"parameters": {
"operation": "find",
"collection": "users",
"query": "={ \"_id\": \"{{$json.headers.authorization.split(' ')[1]}}\" }"
},
"name": "Find User by ID",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
400,
0
],
"credentials": {
"mongoDb": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{$json}}",
"options": {}
},
"name": "Respond User",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
600,
0
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "{\"error\": \"Unauthorized\", \"message\": \"Invalid or missing security key\"}",
"options": {
"responseCode": 401
}
},
"name": "Reject User",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
200,
200
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "api/auth/login",
"options": {}
},
"name": "Login Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
0,
400
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.headers[\"x-acl-auth-key\"]}}",
"operation": "equal",
"value2": "acl_live_sec_8f92a3b4"
}
]
}
},
"name": "Security Guard Login",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
200,
400
]
},
{
"parameters": {
"operation": "find",
"collection": "users",
"query": "={ \"email\": \"{{$json.body.email}}\" }"
},
"name": "Find User by Email",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
400,
400
],
"credentials": {
"mongoDb": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{!!$json[\"_id\"]}}",
"value2": true
}
]
}
},
"name": "User Exists?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
600,
400
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "{\n \"success\": true,\n \"token\": \"{{$json._id}}\",\n \"user\": {{$json}}\n}",
"options": {}
},
"name": "Respond Existing",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
800,
300
]
},
{
"parameters": {
"jsCode": "const email = $node[\"Login Webhook\"].json.body.email;\nconst userType = $node[\"Login Webhook\"].json.body.userType || 'student';\nlet role = userType;\nlet permissions = [];\n\nif (userType === 'institution') {\n role = 'admin';\n permissions = ['view_dashboard', 'bulk_issue', 'view_job_monitor', 'manage_institutions', 'manage_users', 'manage_settings'];\n} else if (userType === 'employer') {\n permissions = ['view_dashboard', 'verify_credential', 'search_talent'];\n} else if (userType === 'creator') {\n role = 'CREATOR';\n permissions = ['issue_credentials', 'view_dashboard'];\n}\n\nreturn {\n email,\n role,\n name: email.split('@')[0],\n permissions,\n createdAt: new Date().toISOString()\n};"
},
"name": "Prepare New User",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
800,
500
]
},
{
"parameters": {
"operation": "insert",
"collection": "users"
},
"name": "Create User",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1,
"position": [
1000,
500
],
"credentials": {
"mongoDb": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "{\n \"success\": true,\n \"token\": \"{{$json._id}}\",\n \"user\": {{$json}}\n}",
"options": {}
},
"name": "Respond New",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1200,
500
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "{\"error\": \"Unauthorized\", \"message\": \"Invalid or missing security key\"}",
"options": {
"responseCode": 401
}
},
"name": "Reject Login",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
200,
600
]
}
],
"connections": {
"Get User Webhook": {
"main": [
[
{
"node": "Security Guard Me",
"type": "main",
"index": 0
}
]
]
},
"Security Guard Me": {
"main": [
[
{
"node": "Find User by ID",
"type": "main",
"index": 0
}
],
[
{
"node": "Reject User",
"type": "main",
"index": 0
}
]
]
},
"Find User by ID": {
"main": [
[
{
"node": "Respond User",
"type": "main",
"index": 0
}
]
]
},
"Login Webhook": {
"main": [
[
{
"node": "Security Guard Login",
"type": "main",
"index": 0
}
]
]
},
"Security Guard Login": {
"main": [
[
{
"node": "Find User by Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Reject Login",
"type": "main",
"index": 0
}
]
]
},
"Find User by Email": {
"main": [
[
{
"node": "User Exists?",
"type": "main",
"index": 0
}
]
]
},
"User Exists?": {
"main": [
[
{
"node": "Respond Existing",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare New User",
"type": "main",
"index": 0
}
]
]
},
"Prepare New User": {
"main": [
[
{
"node": "Create User",
"type": "main",
"index": 0
}
]
]
},
"Create User": {
"main": [
[
{
"node": "Respond New",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
mongoDb
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Auth Service (MongoDB Production). Uses mongoDb. Webhook trigger; 14 nodes.
Source: https://github.com/Aether-Connect-Labs/AcademicChain-Ledger/blob/main/n8n/workflows/auth-production.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Orquestador Multichain AcademicChain. Uses httpRequest, moveBinaryData, mongoDb. Webhook trigger; 23 nodes.
⚠️ COMMUNITY TEMPLATE DISCLAIMER: This is a community-contributed template that uses ScrapeGraphAI (a community node). Please ensure you have the ScrapeGraphAI community node installed in your n8n ins
Institution - Batch Credential Issuance - FIXED. Uses itemLists, mongoDb. Webhook trigger; 8 nodes.