I am trying to set up a custom OAuth2 Client Credentials flow in n8n to manage access and refresh tokens. My goal is to store the access token for reuse between workflow runs until it expires. When a request fails due to token expiration, I want to use an HTTP node to obtain a new access token, using the refresh token, store this new access token, and then retry the request.
But how can I save the access token so it can be reused between workflow runs until expired and then updated using a fresh token node.?
I am self-hosting on Linux VPS in docker container using Coolify.
@DaviG , the whole idea behind the “static data” (as the name suggests) is to persist between the workflow executions. I can only add that the static data won’t be saved between executions unless you:
are using an automatic trigger node (such as schedule or webhook) and
have activated the workflow
Also, be aware that it gets saved after the execution is finished. So it will only be accessible for executions that started after the previous one is done.
I do not know for sure but expect the data to be stored in the database to fulfill its purpose.