Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlevel Credential when used with an HTTP node is not consistently working #12230

Open
Robmobius opened this issue Dec 14, 2024 · 5 comments
Open
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@Robmobius
Copy link

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

  1. Create a Highlevel Oauth 2 credential
  2. This will require a GHL app.
  3. Create an HTTP node and connect it with the HL credential created.
  4. 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)

@Joffcom
Copy link
Member

Joffcom commented Dec 14, 2024

Hey @Robmobius,

We have created an internal ticket to look into this which we will be tracking as "N8N-7966"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Dec 14, 2024
@Joffcom
Copy link
Member

Joffcom commented Dec 14, 2024

Hey @Robmobius

I suspect this is related to an on going issue with the pagination in the http request node not allowing the token refresh.

If you manually build out the pagination loop in your workflow does it then start working as expected?

@Robmobius
Copy link
Author

I have no idea how to do that. Happy to test if you can give me a few pointers on how to "build out the pagination loop"

@Joffcom
Copy link
Member

Joffcom commented Dec 17, 2024

Hey @Robmobius,

Interesting I thought you were using the pagination option in the node but you are not so this looks to be something else. Can you try removing the Accept header and see if that changes anything?

@Robmobius
Copy link
Author

Removing the Accept header gave a successful result, but I tested before removing the success header and it to worked. By now the token should have expired and it should have failed, as that is what it has been doing.

But today it worked fine. I have since updated my n8n to 1.71.3 Maybe there was a fix in the update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants