authentik is an open-source identity provider. Add your users and groups to authentik once, then use the same account to sign in to your other self-hosted apps, such as Grafana, Portainer, or Nextcloud. This is called single sign-on (SSO). authentik uses standards such as OAuth2/OpenID Connect and SAML, and includes two-factor authentication, invitations, and password recovery. In this guide, we’ll show you two ways to set it up: the easy way as a One-Click App, which makes authentik available over HTTPS in just a few clicks, and a manual installation with Docker Compose. Then you’ll connect Grafana using OpenID Connect and protect your admin account with a second factor.
authentik is useful as soon as you self-host more than one or two apps. authentik is a good fit on a VPS if:
- You don’t want to manage separate accounts in every app, and would rather create, disable, and assign users to groups centrally.
- Several people use your apps, such as a team, club, or family, and each person should only see the apps they have access to.
- You want two-factor authentication everywhere, including in apps that don’t offer 2FA themselves, because sign-in happens through authentik.
- Your apps support OpenID Connect, OAuth2, or SAML, as many self-hosted apps do.
Authentik may be less suitable if you only run a single app with a few users. In that case, the app’s built-in sign-in is simpler. authentik is a powerful tool with its own concepts, such as flows, stages, and providers, and it requires more resources than most of the apps it protects.
You’ll also find Keycloak in the app catalog. Both identity providers support OpenID Connect and SAML. authentik also includes a proxy that can protect apps without their own sign-in, and it doesn’t require Java. Keycloak is widely used when software or companies specifically require it.
The quickest way to get started with authentik is through your VPS’s One-Click Apps. The app installs authentik Server, Worker, and a PostgreSQL database, and is available directly over HTTPS when you use a domain. It automatically generates a database password and secret key. You don’t need to configure a reverse proxy, certificate, or firewall rules.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
- At least 2 vCPU cores and 2 GB of RAM; 4 GB of RAM is recommended. Right after startup, the server, worker, and database use around 1.2 GB of RAM combined.
- Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
- Search the app catalog for Authentik and click Install app.
- Use a custom subdomain or zap.cloud is already selected, with a random name. Leave the option enabled or enter a name of your own, such as
ssoorlogin. authentik needs a domain with HTTPS for sign-in to work with other apps. - You don’t need to fill in anything under App configuration. The database username and password, as well as authentik’s secret key, are generated automatically.
AUTHENTIK_TAGsets the version; leave the default value as is. - Click Queue installation.
Error reports to the authentik developers
In the app, AUTHENTIK_ERROR_REPORTING__ENABLED is set to true by default. authentik then sends error reports and anonymous performance data to sentry.io to help developers find bugs. If you don’t want this, set the value to false during installation.
authentik is installed without an admin password. The administrator account is called akadmin; you set its email address and password during initial setup.
Complete initial setup right away While initial setup is still open, anyone who knows your app’s address can set the admin password. Complete it immediately after installation.
- Wait until the app card shows that the app is online. On its first startup, authentik creates its database and sets up the default flows. This takes a few minutes. If the page shows “Not Found” or “Server is starting up,” wait a few minutes and reload it.
- On the app card, click Open initial setup in the Set up admin account notice. Alternatively, add
/if/flow/initial-setup/to your address; the trailing slash is required. - Enter your email address under Email, then set a long, unique password under Password and Password (repeat).
- Your app’s address is already entered under Base URL. Leave it as is, without a path at the end.
- Click Continue. authentik signs you in and displays the Application Dashboard.
Later, sign in at your address using the username akadmin or your email address. The password isn’t shown anywhere in the dashboard, so save it in your password manager. Click Admin interface in the upper-right corner to open the admin area.
Without a mail server, authentik can’t send emails for password recovery, invitations, or alerts. Enter your mail server details in the app settings (gear icon) under App environment: AUTHENTIK_EMAIL__HOST, AUTHENTIK_EMAIL__PORT, AUTHENTIK_EMAIL__USERNAME, AUTHENTIK_EMAIL__PASSWORD, and AUTHENTIK_EMAIL__FROM. For port 587, also set AUTHENTIK_EMAIL__USE_TLS to true; for port 465, set AUTHENTIK_EMAIL__USE_SSL instead.
Update authentik in the app settings (gear icon) under App update. Click Check for updates, then install a new version using Apply update. If the app is up to date, there isn’t a newer version in the app catalog yet.
You can’t go back to an older version authentik doesn’t support downgrades because an update changes the database structure. Before updating, read the release notes and back up your VPS first, for example using Backups in the dashboard.
All users, groups, apps, and settings are stored in the app’s PostgreSQL database. They’re preserved during updates.
The rest of this guide covers a manual installation of authentik with Docker Compose on your VPS—for example, if you don’t use One-Click Apps on your server or want to run authentik behind your own reverse proxy.
- A Linux VPS running Debian or Ubuntu, with SSH access. See First Access via SSH.
- Docker and Docker Compose (Compose v2). See Install Docker. Check the installation with
docker --versionanddocker compose version. - A domain or subdomain whose A record points to your VPS’s IP address (e.g.,
authentik.example.com).
The official documentation specifies a minimum of 2 CPU cores and 2 GB of RAM. With 4 GB of RAM, you’ll have room for the apps you protect with authentik.
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU cores | 2 vCPU cores |
| RAM | 2 GB | 4 GB |
| Storage | 5 GB | 20 GB |
authentik listens on port 9000 (HTTP) and 9443 (HTTPS with its own self-signed certificate). You don’t need to open these ports if you use a reverse proxy as described below. With ufw, allow only SSH and the ports for the reverse proxy:
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Docker bypasses ufw
Ports published by Docker with ports: are accessible from outside even if they’re blocked by ufw. Docker inserts its own rules ahead of the ufw rules. So, as described below, bind authentik only to 127.0.0.1. For more on firewalls, see Managing the Firewall on Linux.
Create a directory for authentik, switch to it, and download the official Compose file:
mkdir -p /opt/authentik
cd /opt/authentik
wget https://docs.goauthentik.io/compose.yml
The file starts three containers: postgresql (database), server (web interface and sign-in), and worker (background tasks). It’s pinned to the version current when you download it—2026.8.7 when this guide was written. Current authentik versions no longer need a separate Redis container.
Now generate the database password and secret key. The commands from the official documentation write both directly to the .env file without displaying them:
echo "PG_PASS=$(openssl rand -base64 36 | tr -d '\n')" >> .env
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')" >> .env
Bind authentik only to the local address so that external access goes through the reverse proxy only. Add two lines to .env:
echo "COMPOSE_PORT_HTTP=127.0.0.1:9000" >> .env
echo "COMPOSE_PORT_HTTPS=127.0.0.1:9443" >> .env
chmod 600 .env
Here’s what the entries mean:
PG_PASS: the PostgreSQL database password. The server and worker read it from.env. PostgreSQL doesn’t support passwords longer than 99 characters; the command above generates a shorter one.AUTHENTIK_SECRET_KEY: signs sign-in cookies. If you change it later, all active sessions become invalid and everyone has to sign in again.COMPOSE_PORT_HTTP/COMPOSE_PORT_HTTPS: the Compose file publishes ports9000and9443. The127.0.0.1:prefix makes them accessible only from the server itself./var/run/docker.sockforworker: authentik can use the Docker socket to start so-called Outposts itself, such as the proxy for apps without their own sign-in. If you don’t need this, you can remove the line as described in the documentation and manage Outposts manually.
Optionally, add your mail server details to .env too, using the same variables as for the One-Click App (AUTHENTIK_EMAIL__HOST, AUTHENTIK_EMAIL__PORT, and so on).
Pull the images and start authentik:
docker compose pull
docker compose up -d
Check whether all three containers are running with docker compose ps. On the first startup, it takes a few minutes for the server and worker to show as healthy.
Don’t mount the time zone into the containers
authentik always uses UTC internally. Don’t mount /etc/timezone or /etc/localtime into the containers; according to the documentation, this interferes with sign-in via OAuth and SAML. The interface will still display times in your time zone.
First, set up the reverse proxy in the next section, then open https://authentik.example.com/if/flow/initial-setup/. This way, the correct Base URL is entered during initial setup. If you want to view authentik first, open an SSH tunnel from your own computer:
ssh -L 9000:localhost:9000 root@SERVER_IP
Replace SERVER_IP with your VPS’s IP address and open http://localhost:9000/if/flow/initial-setup/ in your browser. Enter the email address and password for akadmin. Under Base URL, enter the address where authentik will be available later, such as https://authentik.example.com, then click Continue.
Can’t open initial setup?
If /if/flow/initial-setup/ shows “Not Found,” the worker hasn’t set up the default flows yet. Wait a few minutes. If that doesn’t help, restart the containers with docker compose restart. As a last resort, set the password directly with docker compose exec server ak changepassword akadmin.
To access authentik externally, put a reverse proxy with a valid certificate in front of it. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt).
authentik needs the Host, X-Forwarded-Proto, and X-Forwarded-For headers from the proxy, as well as WebSockets. The following nginx server block is based on the example in the official documentation and forwards requests to HTTP port 9000:
map $http_upgrade $connection_upgrade_keepalive {
default upgrade;
'' '';
}
server {
listen 80;
server_name authentik.example.com;
location / {
proxy_pass http://127.0.0.1:9000;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade_keepalive;
}
}
Then obtain the certificate with certbot --nginx -d authentik.example.com. Certbot adds HTTPS and HTTP redirection to the block. Requests from nginx come from a local or Docker network, which authentik trusts as a proxy by default. No additional setting is needed.
Shorter with Caddy
If you use Caddy instead of nginx, the proxy obtains the certificate itself and sets the required headers automatically. All you need in the Caddyfile is authentik.example.com { reverse_proxy 127.0.0.1:9000 }.
If the sign-in page keeps loading or your browser reports blocked content (“mixed content”), authentik isn’t receiving X-Forwarded-Proto: https. Check the proxy block. For more tips on securing your server, see Linux Security Tips.
The most important part is the PostgreSQL database, which stores all users, groups, flows, apps, and settings. authentik can’t be restored without it. Back it up with pg_dump:
cd /opt/authentik
docker compose exec -T postgresql pg_dump -U authentik -d authentik > authentik-db-$(date +%F).sql
Also back up the data directories (uploaded icons and backgrounds), custom-templates (custom interface changes), and certs, as well as the .env file containing the secret key. Don’t store the backup only on the VPS itself.
Back up the database first and read the release notes for the new version. authentik doesn’t support downgrades. Also, don’t skip major versions: first update to the latest version in your current series (for example, 2026.5.x), then update to the next one.
To update, download the current Compose file, which always points to the latest version. Your .env file remains unchanged:
cd /opt/authentik
wget -O compose.yml https://docs.goauthentik.io/compose.yml
docker compose pull
docker compose up -d
You can see the installed version in the Admin interface under Dashboards > Overview.
After setup, you can connect your first app to authentik. This section walks you through the full process using Grafana and OpenID Connect. You can connect other apps that support OpenID Connect in the same way; only the settings on the app side will differ. Ready-made guides for many apps are available in the authentik integrations.
You’ll need a running Grafana installation with its own domain; see Install Grafana. In the examples, grafana.example.com is Grafana’s domain and authentik.example.com is authentik’s.
In authentik:
- Open the Admin interface and go to Applications > Applications. Click New Application.
- Application step: Enter a name, such as
Grafana, and note the Slug (e.g.,grafana). - Choose a Provider step: Select OAuth2/OpenID Connect.
- Configure Provider step: Make a note of the Client ID and Client Secret. Add
https://grafana.example.com/login/generic_oauthas a Redirect URI of typeStrict. - Finish the wizard by clicking Submit.
In Grafana: Grafana recognizes authentik as “Generic OAuth.” For a Grafana installation with Docker Compose, add these values under environment in the docker-compose.yml file, then restart Grafana with docker compose up -d:
- GF_AUTH_GENERIC_OAUTH_ENABLED=true
- GF_AUTH_GENERIC_OAUTH_NAME=authentik
- GF_AUTH_GENERIC_OAUTH_CLIENT_ID=CLIENT_ID
- GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET=CLIENT_SECRET
- GF_AUTH_GENERIC_OAUTH_SCOPES=openid profile email
- GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://authentik.example.com/application/o/authorize/
- GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://authentik.example.com/application/o/token/
- GF_AUTH_GENERIC_OAUTH_API_URL=https://authentik.example.com/application/o/userinfo/
If you use Grafana as a One-Click App, enter the same details in Grafana under Administration > Authentication > Generic OAuth. In either case, make sure Grafana knows its own address (GF_SERVER_ROOT_URL); otherwise, the redirect after sign-in won’t work. This is already configured in the One-Click App.
Sign in with authentik will then appear on Grafana’s sign-in page. Clicking it takes you to authentik and returns you to Grafana after you sign in. New accounts are initially assigned the Viewer role in Grafana. The authentik Grafana guide explains how to manage roles through authentik.
The akadmin account has access to everything you connect to authentik. Protect it with a second factor:
- Click the gear icon (settings) in the upper-right corner and go to Credentials.
- Under MFA Devices, click Enroll and select TOTP Device for an authenticator app or WebAuthn device for a security key or passkey.
- Scan the QR code with your authenticator app and confirm using the displayed code.
- Also create recovery codes by selecting Enroll > Static tokens, and store them somewhere safe.
From now on, authentik will ask for the second factor when you sign in. This also protects all apps you sign in to through authentik.
Locked out?
If you can’t access authentik at all—for example, after changing a sign-in setting incorrectly—you can generate a link that provides direct access for ten minutes in a manual installation with docker compose run --rm server create_recovery_key 10 akadmin. Don’t share this link with anyone.
- Resources: With its server, worker, and database, authentik needs considerably more RAM than many of the apps it protects. Plan for at least 2 GB of RAM for authentik alone.
- Complexity: Concepts such as flows, stages, providers, and Outposts take time to learn. Don’t change the default flows until you understand what they do, or you could lock yourself out.
- Your app needs to support it: Single sign-on only works with apps that support OpenID Connect, OAuth2, SAML, or LDAP. You can protect apps without their own sign-in using authentik’s Proxy Provider, but that requires a separate, more involved setup.
- An outage affects all apps: If authentik is unavailable, you won’t be able to use SSO to access connected apps. Keep a local admin account in important apps as a backup.
You’ve set up authentik on your VPS, created an admin account, connected Grafana using OpenID Connect, and protected sign-in with a second factor. You can now manage users for your self-hosted apps in one place.
Prefer not to manage Docker yourself? Choose the easy One-Click App option described above under “Easy Option: authentik as a One-Click App.”