Dear All, Problem solved. Firewall blocked the authentication. Beste Grüße, Eugen Bastron
Am 09.11.2026 um 20:18 schrieb LibraryITSolutions via Koha <koha@lists.katipo.co.nz>:
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/
_______________________________________________
Koha mailing list -- koha@lists.katipo.co.nz http://koha-community.org To unsubscribe send an email to koha-leave@lists.katipo.co.nz Unsubscribe: