Describe the problem/error/question
I am getting an authentication error while trying to run my workflow which reads Reddit.
What is the error message (if any)?
The 401 error generally indicates an issue with the authentication credentials or permissions.
Please share your workflow
{
"nodes": [
{
"parameters": {
"numberInputs": 6
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
464,
480
],
"id": "322e674e-61b5-42c5-8a4d-a10be1262d04",
"name": "Merge"
},
{
"parameters": {
"sortFieldsUi": {
"sortField": [
{
"fieldName": "ID"
},
{
"fieldName": "sortKey"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.sort",
"typeVersion": 1,
"position": [
688,
544
],
"id": "5d06b0a0-a9f7-45d8-a66b-011407861d1f",
"name": "Sort"
},
{
"parameters": {
"operation": "appendOrUpdate",
"documentId": {
"__rl": true,
"value": "1w4AyNLwuT3WUhCCDVG0zRsLdMnGj1NjxHnvUbie4JTQ",
"mode": "list",
"cachedResultName": "US study",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1w4AyNLwuT3WUhCCDVG0zRsLdMnGj1NjxHnvUbie4JTQ/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 503042634,
"mode": "list",
"cachedResultName": "AI study 1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1w4AyNLwuT3WUhCCDVG0zRsLdMnGj1NjxHnvUbie4JTQ/edit#gid=503042634"
},
"columns": {
"mappingMode": "autoMapInputData",
"value": {},
"matchingColumns": [],
"schema": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
912,
544
],
"id": "c49be2c1-fe33-48e5-a8bb-bdc6231ea896",
"name": "Append row in Pantip sheet1",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "T1oL4g4LZFXSIRDS",
"name": "Google Sheets account 2"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b96617e6-ff8a-453f-ac6f-0883c558f05b",
"name": "Main Post Text",
"value": "–",
"type": "string"
},
{
"id": "b326897f-0db9-4a7f-8fea-494d404f2e75",
"name": "Comment",
"value": "={{$json.body}}",
"type": "string"
},
{
"id": "831937d2-b94e-4978-b8f4-fecf1762398f",
"name": "Username",
"value": "={{$json.author}}",
"type": "string"
},
{
"id": "38195c1a-279f-46b2-aa5c-7cc31845b3ed",
"name": "Source",
"value": "={{ $json.subreddit_name_prefixed }}",
"type": "string"
},
{
"id": "527a2adf-70d8-4f5c-8f11-5ab03ea4254f",
"name": "Upvotes",
"value": "={{$json.ups}}",
"type": "string"
},
{
"id": "1c58c48a-d6e3-44de-8506-1361463adea1",
"name": "URL",
"value": "={{ $('Search \\\"drinkaid\\\" on r/askSingapore').item.json.url }}",
"type": "string"
},
{
"id": "8d32aaee-3b35-45ca-ace0-48a44d7d27e1",
"name": "ID",
"value": "={{ $('Search \\\"drinkaid\\\" on r/askSingapore').item.json.id }}",
"type": "string"
},
{
"id": "890ef3df-db87-46c4-9d60-c62470a31137",
"name": "rowType",
"value": "comment",
"type": "string"
},
{
"id": "e0f758b9-ca5b-4ddb-9a58-0c880d003dfb",
"name": "sortKey",
"value": "2",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
240,
64
],
"id": "327f921b-5098-4385-beb2-91a6f2efec2b",
"name": "Format comments"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "77da2ed2-75c4-4da5-8133-76d74be05216",
"name": "Main Post Text",
"value": "={{ $json.selftext }}",
"type": "string"
},
{
"id": "6e05abc8-646d-4fb2-9faf-ffe01685df4d",
"name": "Comment",
"value": "–",
"type": "string"
},
{
"id": "b150e1a8-9667-4edb-9c05-b6b776e0ea39",
"name": "Username",
"value": "={{ $json.author_fullname }}",
"type": "string"
},
{
"id": "f34ffa90-af67-4c6e-98da-36c7087ee214",
"name": "Source",
"value": "={{ $json.subreddit_name_prefixed }}",
"type": "string"
},
{
"id": "2774598b-8fab-409a-b087-0a1cf5e751d8",
"name": "Upvotes",
"value": "={{ $json.ups }}",
"type": "number"
},
{
"id": "d9729d2e-a49c-443b-b3b8-02dc868974ff",
"name": "URL",
"value": "={{ $json.url }}",
"type": "string"
},
{
"id": "de4e09bf-0891-4c1f-a064-c3d605add67e",
"name": "ID",
"value": "={{ $json.id }}",
"type": "string"
},
{
"id": "128eead5-14bc-4108-a34e-db2c05ae8488",
"name": "rowType",
"value": "Post",
"type": "string"
},
{
"id": "57ec48eb-c60d-411b-8afc-9a2c1c93222d",
"name": "sortKey",
"value": "1",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
240,
256
],
"id": "5851c825-9b88-4bb5-9dcb-d0e47338689d",
"name": "Format posts"
},
{
"parameters": {
"resource": "postComment",
"operation": "getAll",
"subreddit": "={{ $json.subreddit }}",
"postId": "={{ $json.id }}"
},
"type": "n8n-nodes-base.reddit",
"typeVersion": 1,
"position": [
16,
64
],
"id": "2da1aee8-073f-4a12-bbd4-161628e192cf",
"name": "Get all comments",
"alwaysOutputData": true,
"executeOnce": false,
"credentials": {
"redditOAuth2Api": {
"id": "VqfXh8l6sg0t6MUI",
"name": "Reddit account"
}
}
},
{
"parameters": {
"resource": "postComment",
"operation": "getAll",
"subreddit": "={{ $json.subreddit }}",
"postId": "={{ $json.id }}"
},
"type": "n8n-nodes-base.reddit",
"typeVersion": 1,
"position": [
16,
448
],
"id": "cba2dd2b-107e-48bb-8677-89423b047cba",
"name": "Get all comments1",
"alwaysOutputData": true,
"executeOnce": false,
"credentials": {
"redditOAuth2Api": {
"id": "VqfXh8l6sg0t6MUI",
"name": "Reddit account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "77da2ed2-75c4-4da5-8133-76d74be05216",
"name": "Main Post Text",
"value": "={{ $json.selftext }}",
"type": "string"
},
{
"id": "6e05abc8-646d-4fb2-9faf-ffe01685df4d",
"name": "Comment",
"value": "–",
"type": "string"
},
{
"id": "b150e1a8-9667-4edb-9c05-b6b776e0ea39",
"name": "Username",
"value": "={{ $json.author_fullname }}",
"type": "string"
},
{
"id": "f34ffa90-af67-4c6e-98da-36c7087ee214",
"name": "Source",
"value": "={{ $json.subreddit_name_prefixed }}",
"type": "string"
},
{
"id": "2774598b-8fab-409a-b087-0a1cf5e751d8",
"name": "Upvotes",
"value": "={{ $json.ups }}",
"type": "number"
},
{
"id": "d9729d2e-a49c-443b-b3b8-02dc868974ff",
"name": "URL",
"value": "={{ $json.url }}",
"type": "string"
},
{
"id": "de4e09bf-0891-4c1f-a064-c3d605add67e",
"name": "ID",
"value": "={{ $json.id }}",
"type": "string"
},
{
"id": "128eead5-14bc-4108-a34e-db2c05ae8488",
"name": "rowType",
"value": "Post",
"type": "string"
},
{
"id": "57ec48eb-c60d-411b-8afc-9a2c1c93222d",
"name": "sortKey",
"value": "1",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
240,
640
],
"id": "2501f8d1-3808-4eb4-b08d-f3680904aca3",
"name": "Format posts1"
},
{
"parameters": {
"resource": "postComment",
"operation": "getAll",
"subreddit": "={{ $json.subreddit }}",
"postId": "={{ $json.id }}"
},
"type": "n8n-nodes-base.reddit",
"typeVersion": 1,
"position": [
16,
832
],
"id": "137a7e3a-68b9-4bb9-af83-74ef0a25a64f",
"name": "Get all comments2",
"alwaysOutputData": true,
"executeOnce": false,
"credentials": {
"redditOAuth2Api": {
"id": "VqfXh8l6sg0t6MUI",
"name": "Reddit account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b96617e6-ff8a-453f-ac6f-0883c558f05b",
"name": "Main Post Text",
"value": "–",
"type": "string"
},
{
"id": "b326897f-0db9-4a7f-8fea-494d404f2e75",
"name": "Comment",
"value": "={{$json.body}}",
"type": "string"
},
{
"id": "831937d2-b94e-4978-b8f4-fecf1762398f",
"name": "Username",
"value": "={{$json.author}}",
"type": "string"
},
{
"id": "38195c1a-279f-46b2-aa5c-7cc31845b3ed",
"name": "Source",
"value": "={{ $json.subreddit_name_prefixed }}",
"type": "string"
},
{
"id": "527a2adf-70d8-4f5c-8f11-5ab03ea4254f",
"name": "Upvotes",
"value": "={{$json.ups}}",
"type": "string"
},
{
"id": "1c58c48a-d6e3-44de-8506-1361463adea1",
"name": "URL",
"value": "={{ $('Search \\\"supplements\\\"on askSingapore').item.json.url }}",
"type": "string"
},
{
"id": "8d32aaee-3b35-45ca-ace0-48a44d7d27e1",
"name": "ID",
"value": "={{ $('Search \\\"supplements\\\"on askSingapore').item.json.id }}",
"type": "string"
},
{
"id": "890ef3df-db87-46c4-9d60-c62470a31137",
"name": "rowType",
"value": "comment",
"type": "string"
},
{
"id": "e0f758b9-ca5b-4ddb-9a58-0c880d003dfb",
"name": "sortKey",
"value": "2",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
240,
832
],
"id": "d917aaf6-fc97-4ab8-8856-603a2e281ea2",
"name": "Format comments2"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "77da2ed2-75c4-4da5-8133-76d74be05216",
"name": "Main Post Text",
"value": "={{ $json.selftext }}",
"type": "string"
},
{
"id": "6e05abc8-646d-4fb2-9faf-ffe01685df4d",
"name": "Comment",
"value": "–",
"type": "string"
},
{
"id": "b150e1a8-9667-4edb-9c05-b6b776e0ea39",
"name": "Username",
"value": "={{ $json.author_fullname }}",
"type": "string"
},
{
"id": "f34ffa90-af67-4c6e-98da-36c7087ee214",
"name": "Source",
"value": "={{ $json.subreddit_name_prefixed }}",
"type": "string"
},
{
"id": "2774598b-8fab-409a-b087-0a1cf5e751d8",
"name": "Upvotes",
"value": "={{ $json.ups }}",
"type": "number"
},
{
"id": "d9729d2e-a49c-443b-b3b8-02dc868974ff",
"name": "URL",
"value": "={{ $json.url }}",
"type": "string"
},
{
"id": "de4e09bf-0891-4c1f-a064-c3d605add67e",
"name": "ID",
"value": "={{ $json.id }}",
"type": "string"
},
{
"id": "128eead5-14bc-4108-a34e-db2c05ae8488",
"name": "rowType",
"value": "Post",
"type": "string"
},
{
"id": "57ec48eb-c60d-411b-8afc-9a2c1c93222d",
"name": "sortKey",
"value": "1",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
240,
1024
],
"id": "d5af54d5-421c-42b4-b44d-8e5907723068",
"name": "Format posts2"
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-432,
544
],
"id": "789afbc9-9cb6-46b4-8095-df23d5cd3adf",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"operation": "search",
"subreddit": "supplement",
"keyword": "inflammation",
"returnAll": true,
"additionalFields": {}
},
"type": "n8n-nodes-base.reddit",
"typeVersion": 1,
"position": [
-208,
160
],
"id": "a9044e45-375a-486e-ac05-3eeb6d88357c",
"name": "Search \"drinkaid\" on r/askSingapore",
"alwaysOutputData": true,
"credentials": {
"redditOAuth2Api": {
"id": "VqfXh8l6sg0t6MUI",
"name": "Reddit account"
}
}
},
{
"parameters": {
"operation": "search",
"subreddit": "mumbai",
"keyword": "after drinking ",
"returnAll": true,
"additionalFields": {
"sort": "new"
}
},
"type": "n8n-nodes-base.reddit",
"typeVersion": 1,
"position": [
-208,
544
],
"id": "35f02e39-39ae-4180-8821-0f025595d43c",
"name": "Search \"hangover\"on askSingapore",
"alwaysOutputData": true,
"credentials": {
"redditOAuth2Api": {
"id": "VqfXh8l6sg0t6MUI",
"name": "Reddit account"
}
}
},
{
"parameters": {
"operation": "search",
"subreddit": "bangalore",
"keyword": "next morning after drinking",
"returnAll": true,
"additionalFields": {
"sort": "comments"
}
},
"type": "n8n-nodes-base.reddit",
"typeVersion": 1,
"position": [
-208,
928
],
"id": "1e56cfb7-ffcb-4458-9a9b-730a454b8d76",
"name": "Search \"supplements\"on askSingapore",
"alwaysOutputData": true,
"credentials": {
"redditOAuth2Api": {
"id": "VqfXh8l6sg0t6MUI",
"name": "Reddit account"
}
}
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "1w4AyNLwuT3WUhCCDVG0zRsLdMnGj1NjxHnvUbie4JTQ",
"mode": "list",
"cachedResultName": "US study",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1w4AyNLwuT3WUhCCDVG0zRsLdMnGj1NjxHnvUbie4JTQ/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 503042634,
"mode": "list",
"cachedResultName": "AI study 1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1w4AyNLwuT3WUhCCDVG0zRsLdMnGj1NjxHnvUbie4JTQ/edit#gid=503042634"
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
-576,
560
],
"id": "b574c6e1-909d-461c-9e79-ca65471692e0",
"name": "Get row(s) in sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "T1oL4g4LZFXSIRDS",
"name": "Google Sheets account 2"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b96617e6-ff8a-453f-ac6f-0883c558f05b",
"name": "Main Post Text",
"value": "–",
"type": "string"
},
{
"id": "b326897f-0db9-4a7f-8fea-494d404f2e75",
"name": "Comment",
"value": "={{$json.body}}",
"type": "string"
},
{
"id": "831937d2-b94e-4978-b8f4-fecf1762398f",
"name": "Username",
"value": "={{$json.author}}",
"type": "string"
},
{
"id": "38195c1a-279f-46b2-aa5c-7cc31845b3ed",
"name": "Source",
"value": "={{ $json.subreddit_name_prefixed }}",
"type": "string"
},
{
"id": "527a2adf-70d8-4f5c-8f11-5ab03ea4254f",
"name": "Upvotes",
"value": "={{$json.ups}}",
"type": "string"
},
{
"id": "1c58c48a-d6e3-44de-8506-1361463adea1",
"name": "URL",
"value": "={{ $('Search \\\"hangover\\\"on askSingapore').item.json.url }}",
"type": "string"
},
{
"id": "8d32aaee-3b35-45ca-ace0-48a44d7d27e1",
"name": "ID",
"value": "={{ $('Search \\\"hangover\\\"on askSingapore').item.json.id }}",
"type": "string"
},
{
"id": "890ef3df-db87-46c4-9d60-c62470a31137",
"name": "rowType",
"value": "comment",
"type": "string"
},
{
"id": "e0f758b9-ca5b-4ddb-9a58-0c880d003dfb",
"name": "sortKey",
"value": "2",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
240,
448
],
"id": "68071bfb-4809-466c-8a8a-c926b6d2f851",
"name": "Format comments1"
}
],
"connections": {
"Merge": {
"main": [
[
{
"node": "Sort",
"type": "main",
"index": 0
}
]
]
},
"Sort": {
"main": [
[
{
"node": "Append row in Pantip sheet1",
"type": "main",
"index": 0
}
]
]
},
"Format comments": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Format posts": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Get all comments": {
"main": [
[
{
"node": "Format comments",
"type": "main",
"index": 0
}
]
]
},
"Get all comments1": {
"main": [
[
{
"node": "Format comments1",
"type": "main",
"index": 0
}
]
]
},
"Format posts1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 3
}
]
]
},
"Get all comments2": {
"main": [
[
{
"node": "Format comments2",
"type": "main",
"index": 0
}
]
]
},
"Format comments2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 4
}
]
]
},
"Format posts2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 5
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Search \"drinkaid\" on r/askSingapore",
"type": "main",
"index": 0
},
{
"node": "Search \"hangover\"on askSingapore",
"type": "main",
"index": 0
},
{
"node": "Search \"supplements\"on askSingapore",
"type": "main",
"index": 0
}
]
]
},
"Search \"drinkaid\" on r/askSingapore": {
"main": [
[
{
"node": "Get all comments",
"type": "main",
"index": 0
},
{
"node": "Format posts",
"type": "main",
"index": 0
}
]
]
},
"Search \"hangover\"on askSingapore": {
"main": [
[
{
"node": "Get all comments1",
"type": "main",
"index": 0
},
{
"node": "Format posts1",
"type": "main",
"index": 0
}
]
]
},
"Search \"supplements\"on askSingapore": {
"main": [
[
{
"node": "Get all comments2",
"type": "main",
"index": 0
},
{
"node": "Format posts2",
"type": "main",
"index": 0
}
]
]
},
"Format comments1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "402b321fc1c49325a9502139f8d65de0ed691e3306356f78da9f147947f951a1"
}
}
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main): own
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n
- Operating system: MAC


