I use Authentik with Traefik. This is also assuming you followed the official Authentik intergration guide found here.
This is the screen that I had when logging into Authentik:
On the right there is a 404 error when inspecting the console, which leads to the 401 error – unauthorized. After lots of trial and error, turns out it was due to Uncomplicated Firewall (UFW) blocking the port access of 443 (https).
They are both on the same docker network, I also use labels for traefik. I tried using my config setup in traefik with no luck either. Disabling UFW to test the login process.
sudoufwdisable
This worked! So all that was left was to re-enable authentik and add in the two rules for port 80 (http) and port 443 (https) then reload UFW to enforce the changes
sudoufwenablesudoufwallow80/tcpcomment'Allow HTTP for Traefik'sudoufwallow443/tcpcomment'Allow HTTPS for Traefik'sudoufwreload
Warning: The default setup WILL remove admin priveliges. Best to create a second admin account beforehand. A work around fix is found at the bottom of this article.
Follow the instructions to integrate authentik with Jellyfin here.
Step 9 for role claims needs some extra info if you want to log into Jellyfin with admin access, namely the Admin Roles.
I’ve gone with the default group for Authentik of “authentik Admins”.
You can use a custom group or create one in Authentik by going to: Admin Interface -> Directory -> Groups -> Create
Name it “jellyfin” and leave all as default. Go to users at the top and add the correct users you want admin access to jellyfin.
Enter “jellyfin” in the Admin Roles in the Jellyfin OIDC plugin.
Enjoy 🙂
Fixing broken admin with the OIDC Admin Roles
Credit to Spyros from the comments
If you have set this up with the official instrcutions and need to still add the ‘Admin Roles’ for authentik, navigate to your data at /jellyfin/data/plugins/configurations/SSO-Auth.xml
I absolutely love the fact I can log into authentik and then bypass all app login screens for instant access. This was a slight challenge with Home Assistant as placing this behind Authentik behind this would break the phone companion app. Here is a quick guide on how I overcame this.
This was solved by setting two pathways leading back to my home assistant in traefik, one being behind authentik for the SSO, and the other using the default home assistant login screen for the companion app.
This requires a few things first: Traefik setup with dynamic config HTTP Header Authentication integration for home assistant found here Authentik setup with provider and application, instructions found here
The added lines I used in configuration.yaml in Home Assistant
http:use_x_forwarded_for: truetrusted_proxies: - 10.10.10.0/24# Change to your home network - 172.22.0.0/16# Change to your traefik proxy networkauth_header:username_header: X-authentik-username
The config.yaml for my traefik Please not there is two routers for the one service, one being behind Authentik (/auth) and the other bypassing Authentik. There is also a path prefix for the outpost so there is no 404 error.
http:routers:# Router for SSO - PROTECTED by Authentikhome-assistant:entryPoints: - "https"rule: "Host(`home-assistant.richay.au`) && PathPrefix(`/auth`) && !PathPrefix(`/auth/token`) || PathPrefix(`/outpost.goauthentik.io`))"# Change host domainmiddlewares: - https-redirectscheme - authentiktls: {}service: home-assistant# Router for Companion App - UNPROTECTED by Authentikhome-companion:entryPoints: - "https"rule: "Host(`home-companion.richay.au`) || Host(`home-assistant.richay.au`)"# Change host domainmiddlewares: - https-redirectschemetls: {}service: home-assistantservices:home-assistant:loadBalancer:servers: - url: "http://10.10.10.10:8123"# change this to your IP of your Home AssistantpassHostHeader: truemiddlewares:authentik:forwardAuth:address: "http://authentik-server:9000/outpost.goauthentik.io/auth/traefik"trustForwardHeader: trueauthResponseHeaders: - X-authentik-username - X-authentik-groups - X-authentik-email - X-authentik-name - X-authentik-uid - X-authentik-jwt - X-authentik-meta-jwks - X-authentik-meta-outpost - X-authentik-meta-provider - X-authentik-meta-app - X-authentik-meta-version - authorizationhttps-redirectscheme:redirectScheme:scheme: httpspermanent: true
When you select your server on the companion app, choose the https://home-companion.richay.au option. This will allow the app to work.
When using a web browser, use https://home-assistant.richay.au for SSO access using Authentik.