Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Authentication → Log Out

AI-generated

Overview

The Directus (DrWade) n8n node for the resource Authentication and operation Log Out allows you to log out a user from the Directus API by invalidating their refresh token. This is useful in workflows where you need to programmatically end a user's session, such as after sensitive operations, on user request, or as part of security protocols.

Practical examples:

  • Automatically logging out users after completing a workflow.
  • Forcing logout after password changes or suspicious activity.
  • Integrating with custom authentication flows in n8n automations.

Properties

Name Type Meaning
Refresh Token String JWT refresh token that identifies the session to be logged out. Required.

Output

The node returns a json object containing the response from the Directus API's logout endpoint. The structure of this output depends on the Directus API but typically includes confirmation of the logout action or an error message if the operation failed.

Example output:

{
  "data": {
    // ... any data returned by Directus on successful logout
  }
}

If an error occurs and "Continue On Fail" is enabled, the output will look like:

{
  "error": "Error message describing what went wrong"
}

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:

  • Invalid or expired refresh token: If the provided refresh token is invalid or already expired, the API will return an error.
  • Missing credentials: If the required Directus API credentials are not set up in n8n, the node will fail to connect.
  • Network/API errors: Connectivity issues or incorrect API URLs can cause failures.

Common error messages:

  • "Invalid refresh token": Ensure the token is correct and has not been used or expired.
  • "401 Unauthorized": Check your API credentials and permissions.
  • "Network Error": Verify network connectivity and Directus server status.

How to resolve:

  • Double-check the refresh token value.
  • Ensure the Directus API credentials are correctly configured in n8n.
  • Confirm the Directus instance is reachable from your n8n environment.

Links and References


Discussion