Hello, I’m experiencing persistent issues with Google Gmail, Tasks API, and IMAP integrations in n8n. The workflows initially connect successfully, but they quickly show “Reconnect” or fail with the error “Invalid credentials (Failure).” Here are the details:
Problem Description:
- Gmail API (OAuth2):
- I set up the Gmail node with a new OAuth2 credential.
- Clicking “Connect” successfully authenticates with Google, but immediately after, it shows “Reconnect.”
- I’ve tested this with both personal and work Google accounts, and the issue is consistent.
- Google Tasks API:
- The same behavior occurs: the connection is established momentarily, but then I’m prompted to reconnect.
- IMAP Integration:
- I configured IMAP with an app-specific password (for Gmail) and enabled IMAP access in the account settings.
- However, the error persists:
“Invalid credentials (Failure)”
Error Details:
Example from IMAP:
{
“errorMessage”: “Invalid credentials (Failure)”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.74.3 (Cloud)”,
“binaryDataMode”: “filesystem”,
“stackTrace”: [
“Error: Invalid credentials (Failure)”,
" at Connection._resTagged (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:1502:11)“,
" at Parser. (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:194:10)”,
" at Parser.emit (node:events:518:28)“,
" at Parser._resTagged (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:175:10)”,
" at Parser._parse (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:139:16)“,
" at Parser._tryread (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:82:15)”,
" at TLSSocket.Parser.cbReadable (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Parser.js:53:12)“,
" at TLSSocket.emit (node:events:518:28)”,
" at emitReadable (node:internal/streams/readable:834:12)“,
" at processTicksAndRejections (node:internal/process/task_queues:81:21)”
]
}
}
Example from Gmail API (OAuth2):
{
“errorMessage”: “Unable to sign without access token (item 0)”,
“n8nDetails”: {
“nodeName”: “Gmail”,
“nodeType”: “n8n-nodes-base.gmail”,
“operation”: “getAll”,
“itemIndex”: 0
}
}
Steps Taken:
- Google Cloud Configuration:
- Created new OAuth2 credentials in Google Cloud Console.
- Verified that the following scopes are enabled:
Gmail API: https://www.googleapis.com/auth/gmail.readonly, https://www.googleapis.com/auth/gmail.modify
Tasks API: https://www.googleapis.com/auth/tasks - Added my accounts as test users in the OAuth Consent Screen.
- IMAP Setup:
- Enabled IMAP access in Gmail settings.
- Generated an app-specific password (for accounts with 2FA).
- Verified that IMAP works in other clients (e.g., Thunderbird).
- Testing in n8n:
- Created new credentials for Gmail, Tasks, and IMAP in n8n.
- Authentication succeeds momentarily, but:
Gmail and Tasks prompt to reconnect after a few seconds.
IMAP fails with “Invalid credentials (Failure).”
- Account Variations:
- Tested with two different accounts (personal and work).
- The same behavior persists across both accounts.
Environment:
n8n Version: 1.74.3 (Cloud)
Integration Nodes Affected: Gmail API, Tasks API, IMAP
Google Accounts: Personal Gmail and Google Workspace accounts
Other Clients: IMAP works in Thunderbird with the same credentials.
Questions:
- Is this issue related to n8n’s token management for OAuth2 (e.g., refresh tokens not working properly)?
- Are there known bugs in the Gmail, Tasks, or IMAP nodes in the current n8n version?
- Is there a recommended workaround to avoid the “Reconnect” issue with Google APIs in n8n?
Attachments:
If additional screenshots or examples are needed, I can provide them.
Thank you for your help!