Directus icon

Directus

Consume Directus API

Overview

The "Authentication: Log Out" operation in this n8n node is designed to log a user out from a Directus instance 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, when rotating credentials, or as part of a security protocol.

Practical examples:

  • Automatically logging out users after completing a workflow that involves sensitive data.
  • Forcing logout during account deactivation or password reset flows.
  • Integrating with other systems to ensure users are logged out from Directus when they log out elsewhere.

Properties

Name Type Meaning
Refresh Token String The JWT refresh token for the user session you want to log out. Required.

Output

  • The output will be a JSON object containing the response from the Directus API after attempting to log out the provided refresh token.
  • Typical structure:
    {
      "json": { ... }
    }
    
  • If the operation is successful, the json field will contain the API's response (often an empty object or a status message).
  • If there is an error and "Continue On Fail" is enabled, the output will include an error field with the error message.

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: The node must be configured with valid Directus API credentials (directusApi).
  • Refresh Token: You must provide a valid refresh token to log out the corresponding session.

Troubleshooting

Common issues:

  • Invalid or expired refresh token: If the provided refresh token is invalid or already expired, the API will return an error indicating the token cannot be found or is not valid.
  • Missing required property: If the "Refresh Token" field is left empty, the node will throw an error about missing required parameters.
  • Network/API errors: Issues connecting to the Directus server (e.g., wrong URL, network problems) will result in connection errors.

Error messages and resolutions:

  • "Invalid refresh token": Ensure the token is correct and has not already been used or expired.
  • "Missing required parameter: refresh_token": Make sure the "Refresh Token" property is filled in.
  • "401 Unauthorized": Check your Directus API credentials and permissions.

Links and References


Discussion