Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Authentication → Login

AI-generated

Overview

This node handles user authentication by performing a login operation. It supports logging in with either structured UI input fields or raw JSON parameters. The node is useful for scenarios where you need to authenticate a user and retrieve an access token or session cookie, such as integrating with an API that requires user login.

Use Case Examples

  1. Logging in a user by providing email and password through UI fields to obtain an access token.
  2. Using raw JSON to send complex login parameters including two-factor authentication (OTP).

Properties

Name Meaning
JSON/RAW Parameters Determines whether the login parameters are provided via UI fields or as raw JSON input.
Body Parameters The raw JSON or RAW body parameters for login, used when JSON/RAW Parameters is true.
Password The user's password, required when JSON/RAW Parameters is false.
Email The user's email address, required when JSON/RAW Parameters is false.
Additional Fields Optional extra fields for login, such as mode of token retrieval and OTP for two-factor authentication.

Output

JSON

  • access_token - The access token or session token returned after successful login.
  • token_type - The type of token returned, e.g., Bearer.
  • expires_in - Token expiration time in seconds.
  • refresh_token - Refresh token if provided.

Dependencies

  • Requires an API endpoint for authentication that accepts email, password, and optional OTP.

Troubleshooting

  • Ensure the email and password are correct; otherwise, authentication will fail.
  • If two-factor authentication is enabled, provide the correct OTP to avoid login errors.
  • When using JSON/RAW parameters, ensure the JSON is correctly formatted to prevent request errors.

Discussion