Skip to main content

Overview

Datasources that connect to external platforms (Shopify, Salesforce, Google, Instagram, etc.) authenticate using OAuth client configurations. When a Datasource fails to fetch data, the root cause is often an OAuth issue — expired credentials, a misconfigured token URL, or a broken chain of authentication steps. The OAuth debugging endpoints let you inspect the health of an OAuth client, test token acquisition without affecting live data, clear stale cached tokens, and preview the outgoing authentication request. Each endpoint is designed for safe, non-destructive use in production. All calls require an access token — see Authentication for how to obtain one.
These diagnostic endpoints never store tokens. Every test is strictly a dry run — it verifies the flow and discards the result. Your live Datasource configuration is never modified.

OAuth client status

The status check gives you a snapshot of an OAuth client’s current health. Use it as the first diagnostic step when a Datasource reports authentication errors.

Example response

Response fields

Interpreting the results

Start by checking the credential booleans. The expected values depend on the authentication mode: If the expected credential boolean is false, the OAuth callback likely did not complete successfully. Re-run the authorisation flow for that Datasource.
The hasRefreshToken, hasAccessToken, and hasPassword booleans also appear in the standard OAuth client listing. You do not need the status endpoint to see them — any response that includes an OAuth client will show these fields.

Test token (dry-run)

The test token endpoint executes the full token acquisition flow and reports each step with its outcome, duration, and diagnostic detail. It is the most powerful debugging tool — it tells you exactly which step failed and why.

How it works

The endpoint runs through up to seven steps, stopping at the first failure:

Example response — successful client_credentials flow

Example response — expired refresh token

The refresh token has been revoked or has expired. Re-authorise the Datasource to obtain a new refresh token.

Example response — chained configuration failure

Some OAuth setups use chained authentication, where the first OAuth client’s token is fed into a second client. The test token endpoint handles this automatically — the chained client’s step trace is nested inside the chain_request step.
The primary client authenticated correctly, but the chained client failed at the build_request step. Inspect the nested chainedSteps to identify the exact failure in the second client.
Chained configurations are common with platforms that require a two-stage authentication process — for example, obtaining a platform token first, then exchanging it for a data-access token with a different provider.

Invalidate cache

Reelevant caches access tokens to avoid requesting a new token on every Datasource refresh. The cache uses a time-to-live based on the token’s expiration. In some cases, the cached token may become invalid before its TTL expires — for example, when the external platform revokes it.

Example response — cache existed

Example response — no cache

After invalidation, the next Datasource refresh will request a fresh token from the external platform.
This endpoint requires update permission on the OAuth client (not just read). If you receive a 404, verify that your access token has write access to the Datasource.

Preview request

For OAuth clients using custom_payload or jwt_bearer mode, the authentication request is constructed dynamically from a template with variable substitution. The preview request endpoint shows you the fully interpolated request — exactly what would be sent to the external platform — without actually sending it.

Example response

Use this to verify that variable placeholders (such as {{clientId}} or {{jwt}}) are being replaced correctly and that the request structure matches the external platform’s requirements.
The preview endpoint only works for custom_payload and jwt_bearer modes. For other modes it returns a 400 error, since those modes use standard OAuth flows that do not construct a custom request.

Callback diagnostics

When a user completes the OAuth authorisation flow (clicking “Authorise” in the Datasource wizard), the callback page now shows diagnostic information if something goes wrong.

Success

On a successful callback, the page displays a confirmation message and can be closed.

Failure

On failure, the callback page displays: A token_mismatch error typically means the external platform returned an access token when a refresh token was expected (or vice versa). Check that the OAuth scopes include offline_access or the platform-specific equivalent for obtaining refresh tokens.

Debugging workflow

A recommended sequence for diagnosing a failing Datasource authentication:
1

Check the status

Call GET /oauth/<auth_id>/status to verify credentials are present and check whether a cached token exists.If hasRefreshToken, hasAccessToken, or hasPassword is unexpectedly false, re-authorise the Datasource.
2

Run a dry-run test

Call POST /oauth/<auth_id>/test-token to execute the full token acquisition flow. Read the step trace to identify the first failing step.Common failures:
  • send_request with status 401 → expired or revoked credentials
  • build_request failure → misconfigured request template
  • chain_request failure → issue in the chained OAuth client
3

Invalidate the cache if needed

If the test token succeeds but the Datasource still fails, the issue may be a stale cached token. Call POST /oauth/<auth_id>/invalidate-cache to clear it.
4

Preview the request (custom modes)

For custom_payload or jwt_bearer modes, call POST /oauth/<auth_id>/preview-request to inspect the fully interpolated request and compare it with the external platform’s documentation.

Common issues and solutions


  • Authentication — obtaining an access token to call the Datasources API.
  • Special Configurations — OAuth integration setup, API keys, and other advanced Datasource configurations.
  • Logs — monitoring Datasource execution history.
  • Source Types — configuring different Datasource source types.