Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Authentication → Refresh Token

AI-generated

Overview

The Directus (DrWade) n8n node for the resource Authentication and operation Refresh Token allows you to refresh a JWT access token using a valid, non-expired refresh token. This is useful in workflows where you need to maintain authenticated sessions with a Directus API without requiring users to log in again after their access token expires.

Common scenarios:

  • Automatically refreshing tokens in long-running automation workflows.
  • Ensuring uninterrupted API access by obtaining new access tokens before the current one expires.
  • Integrating with other systems that require up-to-date authentication tokens for secure API calls.

Practical example:
You have an n8n workflow that periodically syncs data from Directus. Instead of prompting for credentials each time the access token expires, you use this operation to seamlessly refresh the token and continue your workflow.


Properties

Name Type Meaning
Refresh Token String The JWT refresh token you want to use to obtain a new access token. Must not be expired.

Output

The output will be a JSON object containing the refreshed authentication information as returned by the Directus API. Typically, this includes:

{
  "access_token": "string",
  "expires": number,
  "refresh_token": "string"
}
  • access_token: The new JWT access token.
  • expires: Expiry timestamp or duration for the new access token.
  • refresh_token: The new refresh token (if provided by Directus).

Note: The exact structure may vary depending on the Directus API version and configuration.


Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials configured in n8n under the name directusApi.

Troubleshooting

Common issues:

  • Expired or Invalid Refresh Token: If the provided refresh token is expired or invalid, the API will return an error. Ensure you are using a valid, unexpired refresh token.
  • Incorrect Credentials: If the Directus API credentials are misconfigured in n8n, authentication will fail.
  • Network Issues: Connectivity problems between n8n and the Directus server can cause failures.

Error messages and resolutions:

  • "Invalid refresh token": Check that the refresh token is correct and has not expired.
  • "401 Unauthorized": Verify your Directus API credentials and permissions.
  • "Network Error": Ensure the Directus API endpoint is reachable from your n8n instance.

Links and References

Discussion