Hi Eugen, I haven't used authentik but I do recall Koha's UserInfo handling wasn't brilliant. Sounds though like the issue would be with the proxy you're using. Not sure what you mean by proxy vs direct here. David Cook Lead Software Engineer Prosentient Systems Suite 7.03 6a Glen St Milsons Point NSW 2061 Australia Office: 02 9212 0899 -----Original Message----- Date: Mon, 9 Nov 2026 20:17:25 +0100 From: LibraryITSolutions <info@libraryitsolutions.com> Subject: [Koha] Koha 26.05.05 – OIDC authentication issue with authentik (UserInfo endpoint returns HTTP 401) To: "koha@lists.katipo.co.nz" <koha@lists.katipo.co.nz> Message-ID: <D1370DEC-5E48-43B3-9D21-44DDCAD30BF6@libraryitsolutions.com> Content-Type: text/plain; charset=us-ascii Dear all, I am trying to integrate Koha 26.05.05 with authentik using OpenID Connect (OIDC), but I am encountering the following errors during authentication: [2026/11/09 16:12:04] [WARN] Use of uninitialized value $user_email in pattern match (m//) at /usr/share/koha/lib/Koha/Auth/Client.pm line 137. [2026/11/09 16:12:04] [ERROR] Exception 'Koha::Exceptions::Auth::Unauthorized' thrown 'External auth user cannot access resource' with code => 401 Interestingly, authentication works correctly when I disable the UserInfo request by bypassing the following condition: if ( defined $config->{userinfo_url} ) To investigate further, I added some debug logging to the OIDC authentication process. Here are the relevant results (all personal information has been anonymized): [OIDC DEBUG] Authentication processing started [OIDC DEBUG] ID_TOKEN claims: acr, amr, aud, auth_time, email, email_verified, exp, family_name, given_name, groups, iat, iss, jti, kohlib_card_no, name, nickname, preferred_username, sid, sub, userid [OIDC DEBUG] ID_TOKEN attributes: email=present, userid=present, preferred_username=present, given_name=present, family_name=present, NameFirst=missing, NameLast=missing, kohlib_card_no=present [OIDC DEBUG] ID_TOKEN mapped data: {"email":"user@example.invalid", "userid":"user123", "firstname":"REDACTED", "cardnumber":"REDACTED", "surname":"REDACTED"} [OIDC DEBUG] ID_TOKEN patron found: YES [OIDC DEBUG] ACCESS_TOKEN: present [OIDC DEBUG] ACCESS_TOKEN type: Bearer [OIDC DEBUG] PROXY USERINFO HTTP: 401 [OIDC DEBUG] PROXY WWW-Authenticate: error="invalid_token", error_description="The access token provided is expired, revoked, malformed, or invalid for other reasons" [OIDC DEBUG] PROXY Content-Type: text/html; charset=utf-8 [OIDC DEBUG] DIRECT USERINFO HTTP: 200 [OIDC DEBUG] DIRECT WWW-Authenticate: undefined [OIDC DEBUG] DIRECT USERINFO claims: email, email_verified, family_name, given_name, groups, kohlib_card_no, name, nickname, preferred_username, sub, userid [OIDC DEBUG] COMPARISON: PROXY=401 DIRECT=200 [OIDC DEBUG] PATRON before abort: YES The ID token contains the expected attributes, the user mapping appears correct, and the corresponding Koha patron is found successfully. Has anyone encountered a similar issue with Koha and authentik? Could this be related to the way Koha sends the UserInfo request, or should I focus further investigation on the authentik/proxy configuration? Any suggestions would be greatly appreciated. Environment: Koha 26.05.05, authentik, OIDC Best regards Eugen Bastron https://libraryitsolutions.com/