Skip to content

bug: CallbackRouteError with OIDC / Authelia #2000

Open
@ninolt

Description

Describe the bug

Hello,

I am brand new to Homarr (few hours in), and as it turns out I arrived just on time for your v1 release. I hope this issue will help you fix some problems !

So I did setup Homarr with Docker and Authelia, with OIDC support for logging in. When clicking on "Login", I get as expected the SSO button proposing me to login with Authelia. When clicking on it, I get a popup saying "Login successfull, you are now logged in", but when calling the callback URI, I stay on the same page, not logged in, with the following URL : https://admin.example.com/auth/login?error=Configuration

Here is the error message in the logs of the container :

C: Read more at https://errors.authjs.dev#callbackrouteerror
    at id (.next/server/chunks/7320.js:491:44893)
    at async ib (.next/server/chunks/7320.js:491:51717)
    at async iR (.next/server/chunks/7320.js:491:56408)
    at async c (.next/server/app/api/auth/[...nextauth]/route.js:1:3352) {
  type: 'CallbackRouteError',
  kind: 'error',
  [cause]: [Object]
}

Steps to reproduce

Authelia config (Nix syntax but I guess it's understandable) :

${dnsName} : "mypublicfacingdnsrecord.com"
${port} : "7575"

services.authelia.instances.main.settings.identity_providers.oidc.clients = [ {
  client_id = "myrandomid";
  client_name = "Homarr";
  client_secret = "myhashedsecret";
  response_types = [ "code" "token" ];
  response_modes = [ "fragment" ];
  authorization_policy = "admin-only"; # (For denying access by default and enabling only admin role with 2FA)
  redirect_uris = [
    "https://admin.${dnsName}/api/auth/callback/oidc"
    "http://localhost:${port}/api/auth/callback/oidc"
  ];
  consent_mode = "implicit";
} ];

My docker-compose file :

name: homarr
services:
  homarr:
    container_name: homarr
    image: ghcr.io/homarr-labs/homarr:latest
    restart: unless-stopped
    volumes:
      - ./appdata:/appdata
    environment:
      - BASE_URL=admin.example.com
      - NEXTAUTH_URL=https://admin.example.com
      # Defined in a seperate env file, managed by Nix and 100% sure present in the container
      # - SECRET_ENCRYPTION_KEY=
      - AUTH_PROVIDERS=oidc
      - AUTH_OIDC_ISSUER=https://auth.example.com
      # Defined in a seperate env file, managed by Nix and 100% sure present in the container
      # - AUTH_OIDC_CLIENT_SECRET=
      - AUTH_OIDC_CLIENT_ID=myrandomid
      - AUTH_OIDC_CLIENT_NAME=Authelia
      # - AUTH_OIDC_AUTO_LOGIN=true
      - AUTH_LOGOUT_REDIRECT_URL=https://auth.example.com/logout
    ports:
      - '7575:7575'

Impact

Unable to log in

Additional information

I don't thinks it is linked to the problem, but fyi I am using Nixos 24.11, Traefik as a reverse proxy, and the container running Homarr is actually running with some witchcraft called compose2nix, a tool for transforming a compose file into a nix service.

Also, I disabled for now the AUTH_OIDC_AUTO_LOGIN=true option, otherwise it keeps failing over and over every second, and I eventually finish with some weird 431 Request Header Fields Too Large, due I guess to the crash loop back off I am in.

Version

1.0.0

Installation method

Docker Compose

Browser

Brave

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions