Directus icon

Directus

Consume Directus API

Overview

The Utilities → Verify Hash operation in this n8n node allows you to verify whether a given string matches a provided hash using the Directus API. This is useful for scenarios where you need to confirm the integrity or authenticity of data, such as password verification, token validation, or checking if a file/string has been tampered with.

Practical examples:

  • Verifying user passwords during authentication flows.
  • Checking if a downloaded file's content matches its expected hash.
  • Validating tokens or other sensitive strings against stored hashes.

Properties

Name Type Meaning
String String The source string to be verified.
Hash String The hash value to verify against.

Output

The output will be an object in the json field. Its structure is:

{
  "result": true // or false
}
  • result: A boolean indicating whether the provided string matches the hash (true if it matches, false otherwise).

If the response from the API is not an object (e.g., a plain string/number/boolean), it will be wrapped as { "result": <value> }.

In case of errors and if "Continue On Fail" is enabled, the output will be:

{
  "error": "<error message>"
}

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.

Troubleshooting

Common issues:

  • Invalid Hash or String: If either the string or hash is missing or malformed, the API may return an error or always return false.
  • Authentication Errors: If the Directus credentials are incorrect or missing, the node will fail to connect.
  • API Connectivity: Network issues or incorrect Directus API URL can cause failures.

Error messages:

  • "error": "Request failed with status code 401": Check your API credentials.
  • "error": "Hash or string parameter missing": Ensure both required fields are filled.
  • "error": "Unexpected token < in JSON at position 0": The API endpoint might be incorrect or returning HTML (e.g., a 404 page).

Links and References

Discussion