REST API Authentication

Hi!

I am trying to understand how to configure authentication in a REST API data source. The plugin docs don’t say anything on this. How do I exchange a client id and secret for a token?

Much appreciated,
Kevin

The REST API functionality allows setting a token in the request header; user ID and key exchange tokens are not currently supported.

I figured out a solution using Workflows. I created a workflow that ran every x minutes as follows:

Screenshot 2026-01-29 143744

The HTTP request sends a POST request to the authentication endpoint with the payload:

{
  "client_id": "{{$env.ClientId}}",
  "client_secret": "{{$env.ClientSecret}}"
}

The ClientID and ClientSecret are stored under “Variables and secrets” along with the base URL for the server.

The data source is already configured with an “Authorization” header, and the SQL action updates the header directly in the database with the “access_token” from the HTTP response:

UPDATE "dataSources"
SET options =
  jsonb_set(
    options::jsonb,
    '{headers}',
    (
      SELECT jsonb_agg(
               CASE
                 WHEN h->>'name' = 'Authorization'
                   THEN jsonb_set(h, '{value}', to_jsonb('{{$jobsMapByNodeKey.c8qx6sej2j5.data.access_token}}'::text), false)
                 ELSE h
               END
             )
      FROM jsonb_array_elements((options->'headers')::jsonb) AS h
    ),
    false
  )
WHERE key = 'my_datasource';

Hi again!

I built a Workflow node plugin that would reload all REST data sources when triggered. This neatly solves the token refresh problem together with the above workflow steps. Code available here:

Cheers,
Kevin