mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-03 00:46:57 -05:00
OIDC Connect - issuer did not match the issuer returned by provider #318
Labels
No labels
area/api
area/caldav
area/filters
area/frontend
area/gantt
area/internal-code
area/typesense
bug
changes requested
confirmed
dependencies
enhancement
good first issue
help wanted
kind/bug
kind/feature
needs reproduction
question
security
support
upstream issue
waiting for reply
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vikunja-go-vikunja#318
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AgusTor-TRW on GitHub (Nov 25, 2024).
Description
Greetings,
We’ve recently installed Vikunja within our Docker Container stack after testing out its functionalities and we’ve noticed the following issue with connecting Vikunja to Keycloak via internal address (as declared in Keycloak, the backend URL)
All of our services exist within the same docker network and have no problem connecting and authenticating with Keycloak, however when attempting the same configuration with Vikunja, we recieve the following error:
Error while getting openid provider keycloak: oidc: issuer did not match the issuer returned by provider, expected "http://<internal-keycloak-address>:8080/realms/<realm-name>" got "https://<external-keycloak-address>/keycloak/realms/<realm-name>"From our testing, we noted that Vikunja attempts to connect to the external Keycloak URL (taken from the response from the discovery URL) when we switch the Keycloak frontend URL to be the same as the internal address within Keycloak’s configuration, Vikunja no longer reports the error but Keycloak can no longer authenticate/redirect due to being on an address inaccessible from the outside. This obviously breaks authentication for all the other services as they are not directly accessible from the outside and only redirected using an Apache Reverse Proxy. (For example, we also host a Gitea thats configured to authenticate with Keycloak using the internal URL which works fine with the current setup)
Our configuration for Vikunja is as follows:
We are not certain if it’s a misconfiguration on our end, a bug with vikunja or maybe Vikunja following the OIDC spec alot more strictly than the rest of our services that are working (Gitea, Nextcloud, etc.)
Thank you in advance
This post was originally posted to the Vikunja Community Forum
Vikunja Version
Latest
Browser and version
Firefox Latest
Can you reproduce the bug on the Vikunja demo site?
No
Screenshots
No response
@chark1es commented on GitHub (Dec 6, 2024):
I dont know if this is correct, but I think its due to how the link is being parsed.
Ill try seeing if I can test it using authentik with a port as the URL.
@kolaente commented on GitHub (Dec 6, 2024):
The
oidc.NewProviderwill use the value that's reported by the provider on.well-known. @AgusTor-TRW what does/.well-known/openid-configurationreport on your Keycloak installation?@AgusTor-TRW commented on GitHub (Dec 10, 2024):
I do not see a field declared as "provider" within the JSON response from https://[external-URL]/keycloak/realms/[domain-name]/.well-known/openid-configuration
The first few lines of the response is as follows:
If you require more info from out openid-configuration JSON please let me know.
@kolaente commented on GitHub (Dec 11, 2024):
There won't be a response field called
providerin the response, but Vikunja will use the values reported by that endpoint to find the urls used to communicate with the openid provider.My next best guess is the mixture of internal and external urls in your Keycloak configuration.
@AgusTor-TRW commented on GitHub (Dec 11, 2024):
Yes, I believe that's the issue. Vikunja seems to compare the frontend URL (as received by the .well-known) to the backchannel URL (as indicated by config.yml).
I don't know if comparing them is the intended behavior when an application uses the backchannel auth per the OIDC spec but OIDC/keycloak should allow for having a different URLs
@kolaente commented on GitHub (Dec 11, 2024):
To me, this looks like an edge case and a potential security issue. To Vikunja, this looks like "I made the request to this endpoint, but the response came from this other endpoint" - which it will refuse because the config says it should only be talking to the endpoint that's configured. Otherwise, it would be possible to change that endpoint on the fly, essentially doing a Man-in-the-middle attack. It's interesting that Keycloak even allows this in their config.
Is there a reason you're not using the same url for everything?
@AgusTor-TRW commented on GitHub (Dec 11, 2024):
We're using the same backchannel URL for all the services hosted on our Docker container stack behind an Apache Reverse Proxy, as based on Keycloak's documentation where it can "connect with Keycloak through your local network, while the server remains publicly accessible". This also lines up with how they suggest to segment exposed paths when using a reverse proxy
Our services (such as Nextcloud, Gitea and Vikunja) don't connect out to the internet and thus have to use the internal address but the user needs to log in on a publicly available URL to actually authenticate themselves with keycloak
@AgusTor-TRW commented on GitHub (Jan 15, 2025):
Have there been any updates to this issue?
@TerrorBite commented on GitHub (Jan 19, 2026):
Having a similar issue here.
Setting up Vikunja as documented resulted in the following error, because Vikunja can't resolve the reverse proxy from inside Docker:
Error while getting openid provider <realm-name>: Get "https://auth.lan.<domain>/realms/<realm-name>/.well-known/openid-configuration": dial tcp <reverse-proxy-lan-ip>:443: i/o timeoutAt that point I realised Vikunja was using backchannel URLs, so I changed the authurl setting to point to Keycloak directly within the cluster. That then resulted in:
Error while getting openid provider lethargiclion: oidc: issuer did not match the issuer returned by provider, expected "http://keycloak:8080/realms/<realm-name>" got "https://auth.lan.<domain>/realms/<realm-name>"Vikunja might not be following the OIDC spec here. I would have expected Vikunja to offer separate settings for backchannel URL (the one Vikunja actually tries to connect to) versus frontchannel URL (the OIDC issuer).
The only way around this that I can see is to try and inject a DNS entry that allows Vikunja to access Keycloak through the reverse proxy. Alternatively, just use LDAP instead of OpenID Connect.
I would like to see Vikunja implement the OIDC Authorization Code Flow rather than only the OIDC Resource Owner Password Flow. This would allow Vikunja to support SSO (Single Sign-On).
@TerrorBite commented on GitHub (Jan 19, 2026):
I put a DNS entry into Docker, but of course Vikunja does not trust the internal CA and there seems to be no way to add a CA certificate to it. So now I am stuck at:
Error while getting openid provider <realm-name>: Get "https://auth.lan.<domain>/realms/<realm-name>/.well-known/openid-configuration": tls: failed to verify certificate: x509: certificate signed by unknown authorityWell, since my original intent in using OpenID connect was to enable SSO (which it seems Vikunja's OpenID implementation doesn't support), there is no point in pursuing OpenID Connect when I can just use LDAP auth instead.