Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus n8n node, when configured with the Users resource and the Disable 2FA operation, allows you to programmatically disable two-factor authentication (2FA) for the currently authenticated user in a Directus instance. This is achieved by providing a valid one-time password (OTP) generated by your authenticator app.
Common scenarios:
- Automating user account management workflows where 2FA needs to be disabled (e.g., during account recovery or administrative actions).
- Integrating with support/helpdesk systems to allow support agents to assist users in disabling 2FA after verifying their identity.
- Building custom admin panels or automation scripts that require toggling 2FA status for users.
Practical example:
A user loses access to their authenticator app. An administrator can use this node in an n8n workflow to disable 2FA for the user after verifying their identity, allowing them to log in and reconfigure 2FA.
Properties
Name | Type | Meaning |
---|---|---|
OTP | String | One-time password generated by the authenticator app. Required for disabling 2FA. |
Output
- The output will be a JSON object containing the response from the Directus API after attempting to disable 2FA.
- The structure of the
json
field typically reflects the Directus API's response, which may include a success message or relevant data about the user's 2FA status.
Example output:
{
"json": {
// Response data from Directus, e.g.,
"status": "success"
}
}
- If an error occurs and "Continue On Fail" is enabled, the output will contain an
error
field with the error message:
{
"json": {
"error": "Error message here"
}
}
Dependencies
- Directus API: You must have access to a running Directus instance.
- API Credentials: The node requires valid Directus API credentials (
directusApi
) configured in n8n. - User Authentication: The operation disables 2FA for the currently authenticated user (the one associated with the provided credentials).
Troubleshooting
Common issues:
- Invalid OTP: If the OTP provided is incorrect or expired, the API will return an error indicating invalid credentials.
- Missing Permissions: The user associated with the credentials must have permission to manage their own 2FA settings.
- Network/API Errors: Connectivity issues or misconfigured API endpoints can cause failures.
Common error messages and resolutions:
"Invalid OTP"
: Ensure you are using a current code from your authenticator app."Unauthorized"
or"Forbidden"
: Check that your API credentials are correct and have sufficient permissions."Cannot read property 'message' of undefined"
: This may indicate an unexpected API response; check the Directus server logs for more details.
Links and References
- Directus Documentation – Two-Factor Authentication
- n8n Documentation – Credentials
- Directus API Reference