Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Overview
This node integrates with the Directus API, a headless CMS and data platform. Specifically, for the Authentication resource and the Refresh Token operation, it allows users to refresh a JWT access token that is still valid (not expired). This is useful in scenarios where you want to maintain an authenticated session without requiring the user to log in again, by exchanging a refresh token for a new access token.
Practical example:
- You have a workflow that interacts with Directus APIs and needs to keep the session alive. Instead of logging in repeatedly, you use this node to refresh the access token using a valid refresh token, ensuring uninterrupted API access.
Properties
| Name | Meaning |
|---|---|
| Refresh Token | The JWT refresh token string used to obtain a new access token. Must not be expired. |
Output
The node outputs JSON data containing the response from the Directus API's token refresh endpoint. Typically, this includes a new access token and possibly other related authentication information.
Example output structure (simplified):
{
"access_token": "newly_generated_access_token",
"expires_in": 3600,
"refresh_token": "new_refresh_token",
"token_type": "Bearer"
}
No binary data output is involved in this operation.
Dependencies
- Requires an active connection to a Directus instance via an API key credential configured in n8n.
- The node uses the Directus API endpoint
auth/refreshwith a POST request. - Proper API credentials and permissions are necessary to perform token refresh operations.
Troubleshooting
Common issues:
- Using an expired or invalid refresh token will cause the API to reject the request.
- Missing or incorrect API credentials can lead to authentication failures.
- Network connectivity problems may prevent reaching the Directus server.
Error messages:
"Invalid refresh token": The provided token is expired or malformed. Obtain a new refresh token by logging in again."Unauthorized"or"Authentication failed": Check that the API credentials are correctly set up and have sufficient permissions.- JSON parsing errors: Ensure the refresh token input is a valid string and properly formatted.
Resolution tips:
- Verify the refresh token is current and has not expired.
- Confirm API credentials in n8n are correct and active.
- Test connectivity to the Directus API outside n8n to isolate network issues.