Configuration

The module configuration is accessible from Home > Setup > Modules > SmartAuth. It is organized in four tabs.

General settings

The Settings tab groups the module's main settings.

SmartAuth general settings configuration page

Token lifetime

Option Description
SMARTAUTH_TOKEN_EOL_DAYS Period (in days) after which a token expires. Possible values: 10, 20, 30 or 90 days. Default: 30 days.

Expired tokens are automatically cleaned up by the scheduled task if cleanup is enabled.

Default user

Option Description
SMARTAUTH_DEFAULT_USER Dolibarr user to use for anonymous actions. Also serves as a global fallback for machine-to-machine calls (client credentials) if no service user is defined on the OAuth client.

Debug mode

Option Description
SMARTAUTH_DEBUG Enables debug logs in the dolibarr.log file. Useful for diagnosing authentication, token or PWA issues. Disable this option in production.

Logs

Option Description
SMARTAUTH_COLLECT_LOGS Enables web log collection. Each API request is recorded in the database. You view the history of actions performed via the API from the Tools > SmartAuth > Logs menu.
SMARTAUTH_CLEAN_LOGS Enables automatic log cleanup by the scheduled task.
SMARTAUTH_LAST_LOGS Log retention period if automatic cleanup is active. Possible values: 10, 20, 30, 90, 180 or 365 days.

Trusted proxies

Option Description
SMARTAUTH_TRUSTED_PROXIES List of your trusted proxy IP addresses, separated by commas (example: 10.0.0.1,172.17.0.1). When a request comes from one of these addresses, the X-Forwarded-For header is used to determine the real client IP address. Private IP addresses (127.x, 10.x, 172.16-31.x, 192.168.x) are automatically considered trusted. Leave empty if you do not use a reverse proxy with a public IP address.

Scheduled task

SmartAuth registers a scheduled task (cron) that runs once a day. It cleans up expired tokens and old logs (if automatic cleanup is enabled).

To check or change the execution frequency:

  1. Go to Home > Setup > Scheduled tasks
  2. Search for the "SmartAuth" task
  3. Enable it if it is not already

Warning: The scheduled task is disabled by default. Enable it manually after installing the module.