Bug Description
I have configured an HTTP node to hit a High Level endpoint. For credentials I am using the predefined Oauth2 HL credential. This works fine initially but quickly stops working after a short period of time, usually a few minutes. Simply opening the credential without editing anything, and reconnecting solves the issue and the credential is valid for a few minutes again.
This is also mentioned in the community here - https://community.n8n.io/t/go-high-level-oauth2-0-refresh-token-issue/61822
To Reproduce
- Create a Highlevel Oauth 2 credential
- This will require a GHL app.
- Create an HTTP node and connect it with the HL credential created.
- Execute the HTTP node - example JSON for node
{ "nodes": [ { "parameters": { "url": "=https://services.leadconnectorhq.com/locations/{{ $('Set URL to Scrape').item.json[\"Location ID\"] }}/customFields", "authentication": "predefinedCredentialType", "nodeCredentialType": "highLevelOAuth2Api", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Accept", "value": "application/json" }, { "name": "Version", "value": "2021-07-28" } ] }, "sendBody": true, "bodyParameters": { "parameters": [ { "name": "limit", "value": "50" } ] }, "options": {} }, "id": "8f98f9b1-eca9-4a7f-b8e4-bb417bb8c74f", "name": "List Custom Fields in MT", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 740, 920 ], "credentials": { "highLevelOAuth2Api": { "id": "Kj2CCKtHi8ZQS5q3", "name": "Humanoid Sub Account" } } } ], "connections": {}, "pinData": {} }
5. Wait several minutes and try execute the node again.
6. I have received the error
`{
"error": "invalid_grant",
"error_description": "This refresh token is invalid"
Here is the full error code
{ "errorMessage": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. [item 0]", "errorDetails": { "rawErrorMessage": [ "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client." ], "httpCode": "EAUTH" }, "n8nDetails": { "nodeName": "List Custom Fields in MT", "nodeType": "n8n-nodes-base.httpRequest", "nodeVersion": 4.2, "itemIndex": 0, "time": "14/12/2024, 14:12:04", "n8nVersion": "1.66.0 (Self Hosted)", "binaryDataMode": "default", "stackTrace": [ "NodeApiError: The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.", " at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1306:19)", " at processTicksAndRejections (node:internal/process/task_queues:95:5)", " at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:2077:20)" ] } }
Expected behavior
The credential should persist as the access token is valid for a day and the refresh token is valid for a year
https://highlevel.stoplight.io/docs/integrations/a04191c0fabf9-authorization#oauth-faqs
Operating System
Ubuntu with Docker
n8n Version
1.66.0
Node.js Version
Unsure
Database
SQLite (default)
Execution mode
main (default)
Bug Description
I have configured an HTTP node to hit a High Level endpoint. For credentials I am using the predefined Oauth2 HL credential. This works fine initially but quickly stops working after a short period of time, usually a few minutes. Simply opening the credential without editing anything, and reconnecting solves the issue and the credential is valid for a few minutes again.
This is also mentioned in the community here - https://community.n8n.io/t/go-high-level-oauth2-0-refresh-token-issue/61822
To Reproduce
{ "nodes": [ { "parameters": { "url": "=https://services.leadconnectorhq.com/locations/{{ $('Set URL to Scrape').item.json[\"Location ID\"] }}/customFields", "authentication": "predefinedCredentialType", "nodeCredentialType": "highLevelOAuth2Api", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Accept", "value": "application/json" }, { "name": "Version", "value": "2021-07-28" } ] }, "sendBody": true, "bodyParameters": { "parameters": [ { "name": "limit", "value": "50" } ] }, "options": {} }, "id": "8f98f9b1-eca9-4a7f-b8e4-bb417bb8c74f", "name": "List Custom Fields in MT", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 740, 920 ], "credentials": { "highLevelOAuth2Api": { "id": "Kj2CCKtHi8ZQS5q3", "name": "Humanoid Sub Account" } } } ], "connections": {}, "pinData": {} }5. Wait several minutes and try execute the node again.
6. I have received the error
`{
"error": "invalid_grant",
"error_description": "This refresh token is invalid"
Here is the full error code
{ "errorMessage": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. [item 0]", "errorDetails": { "rawErrorMessage": [ "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client." ], "httpCode": "EAUTH" }, "n8nDetails": { "nodeName": "List Custom Fields in MT", "nodeType": "n8n-nodes-base.httpRequest", "nodeVersion": 4.2, "itemIndex": 0, "time": "14/12/2024, 14:12:04", "n8nVersion": "1.66.0 (Self Hosted)", "binaryDataMode": "default", "stackTrace": [ "NodeApiError: The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.", " at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1306:19)", " at processTicksAndRejections (node:internal/process/task_queues:95:5)", " at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:2077:20)" ] } }Expected behavior
The credential should persist as the access token is valid for a day and the refresh token is valid for a year
https://highlevel.stoplight.io/docs/integrations/a04191c0fabf9-authorization#oauth-faqs
Operating System
Ubuntu with Docker
n8n Version
1.66.0
Node.js Version
Unsure
Database
SQLite (default)
Execution mode
main (default)