Skip to main content
Directus provides flexible authentication options to integrate with your existing identity infrastructure or use built-in user management.

Authentication Methods

Directus supports multiple authentication drivers that can be used individually or in combination:
  • Local - Email and password authentication
  • OAuth 2.0 - Generic OAuth 2.0 provider integration
  • OpenID - OpenID Connect authentication
  • LDAP - Active Directory and LDAP integration
  • SAML - SAML 2.0 single sign-on

Local Authentication

The default authentication method using email and password stored in Directus.

Configuration

Login Flow

Password Hashing

Passwords are hashed using Argon2, a secure password hashing algorithm:

Authentication Modes

Directus supports three authentication modes:

JSON Mode (Default)

Tokens returned in JSON response:
Tokens stored in HTTP-only cookies:

Session Mode

Long-lived session in cookie:

OAuth 2.0

Integrate with any OAuth 2.0 provider (Google, GitHub, Facebook, etc.).

Configuration

OAuth Login Flow

User Mapping

Map OAuth profile fields to Directus user fields:

OpenID Connect

Modern authentication protocol built on OAuth 2.0.

Configuration

Token Refresh

OpenID tokens are automatically refreshed:

LDAP Authentication

Integrate with Active Directory or LDAP servers.

Configuration

LDAP Login

Group-based Roles

Map LDAP groups to Directus roles:
  1. Create role in Directus with matching name
  2. LDAP users in that group automatically get the role
  3. Roles sync on each login

SAML 2.0

Enterprise single sign-on via SAML.

Configuration

Token Management

Access Tokens

Short-lived JWT tokens (default 15 minutes):

Refresh Tokens

Long-lived tokens to get new access tokens (default 7 days):

Token Refresh

Two-Factor Authentication

Enable TOTP-based 2FA for users:

Session Management

Login Stall Time

Prevent timing attacks:

Session Security

SSO Events

Hook into authentication events:

Best Practices

Never commit OAuth secrets, LDAP passwords, or API keys. Use environment variables.
Require 2FA for admin users to prevent unauthorized access.
Always use HTTPS for OAuth callbacks and cookie-based authentication.
Use group-based role mapping with SSO to automate access control.
Track failed logins in the activity log and implement rate limiting.