Skip to content

Built-In Authentication

Multi-scrobbler has built-in authentication for the dashboard and most API endpoints.

This Authentication Mode is the default when no config is present. It can be explicitly set through the ENV AUTH_MODE=default or AIO auth.mode: 'default' config.json.

Once your instance is secured the dashboard and all API endpoints, except those listed below, require authenticated access.

These endpoints are always unsecure or use their own authentication via config.

Sources With Ingress Endpoints

Sources that use Ingress endpoints for capturing listening activity are always unauthenticated or use their own auth/token via config.

Listenbrainz Endpoint Source

  • /1/* - standard route
  • /api/listenbrainz* - custom Listenbrainz Endpoint with slug

Last.fm Endpoint Source

  • /2.0/ - standard route
  • /api/lastfm* - custom Last.fm Endpoint with slug

Webscrobbler Source

  • /api/webscrobbler* - standard/custom route
Multi-Scrobbler Basic Info and Metrics

These routes provide basic health/info which is safe to expose.

  • /api/health (only the status code unless authenticated)
  • /api/version

Prometheus metrics (/api/metrics) require authentication once the instance is secured. Scrape them with a Read API key. Set PROMETHEUS=false to remove the endpoint entirely.

On first startup Multi-scrobbler creates a single admin account automatically (username admin, or the value of ADMIN_SETUP_USER). It has no password until you set one. Until then, every request is treated as the admin and the dashboard/API are accessible to anyone.

Set the admin password in either of these ways:

Visit the dashboard at and click Set an admin password in the displayed warning banner (or open /setup). You are logged in once it is set.

Depending on how it is accessed, while MS is insecure (no password is set and AUTH_MODE is not disabled) it protects itself in a few ways:

A random setup token is generated on every startup and printed in the console/docker logs and log file. It is not shown in the dashboard’s logs. It is required to set the password from the dashboard when:

  • you appear to be connecting from the internet (a public IP address), or
  • you are using the dashboard through a domain it does not recognize
Common Deployment Setups and How To Secure Them
Setup Setup token needed? Unsecured dashboard How to secure
LAN, dashboard by IP (192.168.0.101:9078) No Full access Open /setup and set a password
LAN, by nas:9078, mycoolsite.local, ms.lan No Full access Open /setup and set a password
LAN, by your own domain on local DNS or a hosts file (ms.mydomain.com), no BASE_URL Yes Read-only Enter the token from the console output on /setup; or open /setup by IP; or set ALLOWED_HOSTS/BASE_URL
Tailscale, by 100.x.y.z, MagicDNS name or *.ts.net No Full access Open /setup and set a password
Reverse proxy on your LAN, BASE_URL set to its domain No Full access Open /setup and set a password
Reverse proxy or Cloudflare Tunnel reachable from the internet, used from outside Yes Full access by the BASE_URL domain, else read-only Enter the token from the console output on /setup
Port forwarded to the internet Yes Full access by IP, read-only by a dynamic DNS name Enter the token from the console output on /setup
Authenticating reverse proxy (Authelia, Authentik…) - - Use AUTH_MODE=disabled
Any - - Set ADMIN_SETUP_PW and restart

Change the username from Settings -> Account while logged in. This only changes the name used to log in.

Change the password from Settings -> Account while logged in. All other sessions are logged out.

If you have forgotten it, set ADMIN_RESET_PW and restart. The password is reset, and all admin sessions are logged out. The same value is only applied once, so the reset does not happen again on every restart, but remove ADMIN_RESET_PW after you have logged in.

A login lasts 7 days since the dashboard was last used. Each visit extends it, so you stay logged in as long as you use the dashboard at least once in that period.

Change the lifetime with AUTH_SESSION_EXPIRES (or auth.sessionExpires), using the same duration formats as retention: a number of seconds (86400), a duration string (12 hours, 30 days), or an ISO 8601 duration (P30D). The minimum is 60 seconds.

API keys let scripts, Prometheus and other tools use the API without logging in. Create and delete them from Settings -> Account while logged in. The key is only shown once, when it is created.

Each key has a scope:

  • Read can only make GET requests, including metrics.
  • Write can use every endpoint, including those that change data.

Send the key in the Authorization header:

Terminal window
curl -H "Authorization: Bearer ms_..." http://localhost:9078/api/components

Scraping metrics with Prometheus:

prometheus.yml
scrape_configs:
- job_name: multi-scrobbler
metrics_path: /api/metrics
authorization:
credentials: ms_...
static_configs:
- targets: ['localhost:9078']

Requests with an invalid key are logged as Invalid API key from <ip>.

A setup token is generated on every startup while the instance is not secured, and printed in the console/docker output and log file. It is only required in some situations.

Set AUTH_SETUP_TOKEN to always require it when setting the first password from the dashboard:

  • AUTH_SETUP_TOKEN=true uses the generated token.
  • Any other value is used as the token.

By default multi-scrobbler accepts requests for any host (IP, hostname, etc.), so no configuration is needed. Logins are protected against cross-site requests regardless. These settings can additionally be configured to expand or restrict what types of requests MS trusts:

ALLOWED_HOSTS (or auth.allowedHosts): comma-separated hosts (with port, wildcards allowed, like ms.mydomain.tld,192.168.0.101:9078) the dashboard is accessed from. Restricting this adds another layer of origin checks. If you set BASE_URL multi-scrobbler logs a hint with the host to use.

Environmental Variable Default Description
AUTH_MODE default default, or disabled. See Securing Multi-Scrobbler
ADMIN_SETUP_USER admin Initial admin username. Only used when the admin account is created. 3-30 letters, numbers, underscores or dots
ADMIN_SETUP_PW Initial admin password. Only used if the admin has no password
ADMIN_RESET_PW Reset the admin password and log out all sessions. Remove after use
AUTH_SETUP_TOKEN Always require the setup token. true for the generated token, or the token itself
ALLOWED_HOSTS * Comma-separated hosts the dashboard is accessed from
SECURE_COOKIES true if BASE_URL is https Only set https-only cookies
TRUST_PROXY false Trust X-Forwarded-* headers
AUTH_SESSION_EXPIRES 7 days How long a login lasts since the dashboard was last used. See Sessions
BETTER_AUTH_SECRET generated Secret used to sign sessions. If not set, one is generated and saved as auth.secret in the data directory