QuotiAuth icon

QuotiAuth

Authenticates users from Quoti

Overview

This node authenticates users against the Quoti service by validating their permissions and retrieving user data. It is useful in workflows where you need to verify a user's identity and access rights before proceeding with further actions. For example, it can be used to gate access to sensitive operations based on whether the user has specific permissions or to enrich workflow data with authenticated user details.

The node checks if the user holds any of the specified permission clusters and outputs either the validated user data or an error indicating missing permissions or authentication failure.

Properties

Name Meaning
Permissions A JSON array of arrays of strings representing permission clusters to check, e.g., [["users.list"], ["admin.access"]]. The node validates if the user has at least one cluster of these permissions.
Output Only User's Data Boolean flag. If true (default), the output contains only the authenticated user's data. If false, the output includes the original input data, the user data, and the permissions that passed validation.
Options Collection of optional parameters:
- User Token: Override the token used for authentication. Must start with Bearer (for user tokens) or BearerStatic (for service account tokens).
- Organization Slug: Override the organization slug from credentials.
- Organization API Key: Override the API key from credentials.

Output

The node produces two outputs:

  • Pass output: Items where the user was successfully authenticated and had the required permissions.

    • json.user: Contains the authenticated user's data retrieved from Quoti.
    • If "Output Only User's Data" is false, the output also includes the original input data and a field quotiAuthValidatedPermissions listing the permissions that passed validation.
  • Fail output: Items where authentication failed or the user lacked required permissions.

    • json.user: Contains the user data if available.
    • json.error: An object describing the error, including:
      • message: Error description (e.g., missing permissions, invalid token).
      • type: Error type such as unauthorized, unauthenticated, or unknown.
      • errorData: Additional error details for unknown errors.

The node does not output binary data.

Dependencies

  • Requires an external Quoti API service for user authentication and permission validation.
  • Needs an API key credential configured in n8n for the Quoti service, which can be overridden via node options.
  • Uses the quoti-auth library internally to perform authentication and permission checks.
  • The user token must be provided either in the input data headers or explicitly set in the node options.

Troubleshooting

  • Missing or invalid credentials: If no credentials are returned or the API key is incorrect, the node will throw an error. Ensure valid API key credentials are configured or properly overridden.
  • Invalid token format: The token must start with Bearer or BearerStatic. Otherwise, an error is thrown.
  • Token expired or invalid: Errors mentioning missing authentication or expired Firebase ID tokens indicate the token is invalid or expired. Refresh or replace the token.
  • Malformed permissions parameter: The permissions property must be a valid JSON string representing an array of arrays of strings. Invalid JSON or structure causes an error.
  • User lacks permissions: If the user does not have any of the specified permission clusters, the item is routed to the fail output with an unauthorized error message.

Links and References

Discussion